Question : Using VBA to transfer CSV in AC07

I am using the following code under a command button to import an Excel spreadsheet into a table in AC07

DoCmd.TransferSpreadsheet acImport, , "DNS_Scrub", filename, False, Range

It works fine, but the original ss is in .CSV format, and I have to open it and save it as an Excel ss in order for it to work.  

Does anyone know how I can alter the code to allow importing a comma separated file?

Answer : Using VBA to transfer CSV in AC07

to create an import specification

1. File>get external data>import
2. select in the File of types box   Text files (*.txt etc..
3. select the file
4. in the import text wizard window select  delimited
5. Click advanced
6. in the import specification window
    type the name of the field in the Field Name column
    (here you can use the field names of the destination table, specify data type,
      check the box Skip if you do not want to import the column)


7 click save as, give the specification a name  <-- this is the specification name that you will use in the command line below
Random Solutions  
 
programming4us programming4us