Hello,

I have an access table where I have to import a csv file.
I have a very simple code in the Click _ Event Sub.
However it seems the code is ok, file gets imported but I get a separate table with errors in import.
In that table two fields are specified as error fileds.
The fields data type is numeric and I have set the filed definition in the table as number for both. I tried saving the problem fileds in the csv file as text and then in design view changed the fileds type to text. That did not work too.
What can I do to prevent a second "error" table to be created and the csv file to get imported in the access table ok ?

Here is my code:

Option Compare Database

Private Sub Command0_Click()
 DoCmd.TransferText acImportDelim, "File Import Specification", "File", "C:\File.csv", 0
End Sub

Thanks in advance

Recommended Answers

All 2 Replies

What is the field size for the number fields in the table?

So you actually created an import specification which is called "File Import Specification?"

Perhaps if you haven't figured it out yet and want to send me your database file and your csv file, I can see what is up.

I can PM you my email address if you wish. Let me know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.