This works for importing an entire table from the ODBC database into Access:
DoCmd.TransferDatabase acImport, "ODBC Database", "ODBC;DSN=SuperBase", acTable, "BDONAMES", "BDONAMES", False
But there is a table in the ODBC database with 517 fields and I only want to import, let's say, 5 or 6 columns/fields. What is the best way to do this using VBA? I googled for a couple days and read 10 or 15 threads on stackoverflow but I haven't seen this specific question answered. Thanks in advance
Try something on the lines of:
sSQL="SELECT This,That,TheOther,Columns INTO BDONames " _
& "FROM [ODBC;DSN=SuperBase].BDONAMES"
CurrentDB.Execute sSQL
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.