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  
  •  MS Access Dates and Selecting a Range Between Two Dates in an Access Report
  •  How many types of mobile OS and browsers?
  •  How to force Outlook to save contacts into public contacts folder??
  •  "Your changes could not be saved to {filename} but were saved to a temporary document named {3F8C6100}. Close the existing document, then open the temp document and save it under a new name"
  •  LINQ Query not yielding expected results
  •  How can I get the windows version from a dos prompt
  •  Need help getting started with n-tier design in asp.net 3.5
  •  Microsoft Word doc only show important text when "non-printing characters" is on
  •  Error 'TCP/IP must be confirgured' when installing windows 2003 server as a first domain controller
  •  Using XIRR in ACCESS , SQL TO VBA Conversions , Getting Runtime Error 1004
  •  
    programming4us programming4us