Importing .csv file

E

Emma

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?
 
K

Ken Snell [MVP]

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
 
E

Emma

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.
 
K

Ken Snell [MVP]

Then try this:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top