Import multiple excel csv files into access

wilkinn

New member
Local time
Yesterday, 21:16
Joined
Feb 2, 2007
Messages
1
I am new to access and vba so please bare with me.

I need vba code to import multiple csv excel files into a access table.

I am new to what I am doing and need a little guidance.

Any help would be appreciated.

thank you in advance for your help and time. :)
 
Basically you want to import the first csv file manually and save the import specification.
Goto File... Get external Data... Import

Then run through the wizard, then Save the import spec.

Remember what you named it.

Then in a form behind a button click or in a module, try this code:
DoCmd.TransferText acImportDelim, "MyImportSpecName", "MyTableName", "C:\myfile.csv"
 
hello.
ive just read this post and it really helped a lot.

i have a question though.

i have a CSV file whose internal data are the following:

F1, 1111, OK, I
F1, 2222, NG, You
F2, 3222, OK, You
F2, 4777, OK, I
F2, 0123, NG, You
F3, 0011, OK, I
F3, 0021, OK, I

when i used DoCmd.Transfertext to transfer this CSV file to a table, i was just confused about the result.
the resulting table contains these data...

F1, 1111, OK, I
F2, 3222, OK, You
F3, 0011, OK, I

It seems that the first entry was filtered.
Why is this so?
Is there a way that ALL the CSV data be transferred to the Table?

Thanks and more power to this forum. :D
 
uh oh sorry, i just got a lil excited with this :p

ive just figure out what went wrong, the culprit was the primary key :rolleyes:
i just removed the primary key and voila, everything is ok now...

just thought that i would not delete my post coz maybe somebody out there might encounter same problem as this...this post could be of help

thanks again :D


hello.
ive just read this post and it really helped a lot.

i have a question though.

i have a CSV file whose internal data are the following:

F1, 1111, OK, I
F1, 2222, NG, You
F2, 3222, OK, You
F2, 4777, OK, I
F2, 0123, NG, You
F3, 0011, OK, I
F3, 0021, OK, I

when i used DoCmd.Transfertext to transfer this CSV file to a table, i was just confused about the result.
the resulting table contains these data...

F1, 1111, OK, I
F2, 3222, OK, You
F3, 0011, OK, I

It seems that the first entry was filtered.
Why is this so?
Is there a way that ALL the CSV data be transferred to the Table?

Thanks and more power to this forum. :D
 

Users who are viewing this thread

Back
Top Bottom