Skip to content
Advertisement

Import Data into Excel from Access Table

I am trying to import data into Excel from an Access table. I am getting a syntax error This error comes up when I run the line: Select [Time], [Tank], FROM "UnitOneRouting", WHERE [Date] = " & RpDate & ORDER BY Tank, Time", cn, adOpenStatic, adLockOptimistic, adCmdTable In the Access Table there are four columns (in order) Date, Time, Tank, Comments. I only want to import two columns, Time and Tank but in the order Tank, Time; and I want to import them based on a date that is given in the Excel sheet. Thanks

How can I rearrange the following section to open the table, select the columns (based on date) and import the data.

CODE STARTS HERE

Advertisement

Answer

The issue is the second and third .Open command. adjust your with statement to:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement