0

One really annoying thing about Access is that when using the import wizard to import a CSV file, if there is a column in the CSV that isn't a field in the table being imported into, it gives you an error and shuts down the import. It should provide an option to skip columns in the source file if it isn't in the already existing table. Yes, it does give the option to skip if creating a new table from the source file, but that isn't what I am doing. Is there a solution to this or a way to automate it? Does using the VBA Access import function permit this?

The reason I want to skip these columns is because they were calculated columns in Excel file submitted by client, file is converted to CSV for importing in to Access, and I can easily recalculate them with SQL in Access. No reason to have them in the table.

cjones
  • 8,384
  • 17
  • 81
  • 175
  • Does the advanced button in the bottom-left hand corner of the wizard not work? I was able to successfully import a CSV with three columns into a table with two columns by checking "Skip" on the extra CSV column in the Advanced menu of the import wizard. EDIT: I am appending, not creating a new table. – MoondogsMaDawg Mar 10 '16 at 13:48
  • Good call. Anyway to automate it though? Looking at documentation and the object browser doesn't seem to be any parameter called `skip`. I guess I am kind of leaning towards creating an array of the field names in the table and an array of the column names in the CSV, iterating through and putting matches into a separate CSV to upload. – cjones Mar 10 '16 at 17:22
  • you may want to peruse some other questions first. I do not know enough VBA to help automate it. http://stackoverflow.com/questions/7747105/specify-target-columns-on-import-csv-to-access – MoondogsMaDawg Mar 10 '16 at 17:37

1 Answers1

0

When running the import wizard, you can save the specifications by some name you choose.

Then use:

DoCmd.TransferText acImportDelim, SpecificationName, ... etc.
Gustav
  • 53,498
  • 7
  • 29
  • 55