Importing .csv file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi There,

I am getting an invalid argument when running this code. I am trying to
import a .csv file into an access table.

Private Sub TransferFile_CmdBtn_Click()

DoCmd.OpenQuery "Flush_Usage_Query"

usageFile = "C:\Documents and Settings\Administrator\My
Documents\NetManage\RUMBA\AS400\usage_query.csv"

DoCmd.TransferText acImportDelim, , "Usage_Query", usageFile, , , True

End Sub

Can someone help me?
 
What is the name of the table to which you are trying to import the data?
Your syntax is completely wrong...see Help file for details. The correct
syntax for this action is this (assuming that the csv file contains the
names of the fields):

DoCmd.TransferText acImportDelim, "SpecificationName", "TableName",
"PathAndFileName", True
 
The access table name is "usage_query". The .csv file does not contain any
field names and I'm okay with that. I just need to get the data in access.
 
Then try this:

DoCmd.TransferText acImportDelim, , "usage_query", usageFile, False
 
Back
Top