Trying to import text (.csv) into access but fails

johnawebbhsd

New Member
Joined
Apr 4, 2003
Messages
47
I am trying to import a .txt or .csv file into access using Macro or VB code. Everything I try I get invalid field error. My table has 4 fields as seen below, seperated by comma. Currently we do this manually by opening the csv w/ xls then manually copy and paste all of these files into access.

Any ideas on how to get around this error?
have tried transferdatabase and transfertext



1234567890,08/14/03,108,108,08/14/03

Thanks,
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
johnawebbhsd said:
I am trying to import a .txt or .csv file into access using Macro or VB code. Everything I try I get invalid field error. My table has 4 fields as seen below, seperated by comma. Currently we do this manually by opening the csv w/ xls then manually copy and paste all of these files into access.

Any ideas on how to get around this error?
have tried transferdatabase and transfertext



1234567890,08/14/03,108,108,08/14/03

Thanks,
If you use File>Get External Data>Import... to get your file, then in the Wizard select the Advanced button you can set up all the fields for the import and then save the Import specs.
You can use this saved Spec from code to re-import latter

HTH

Peter
 
Upvote 0

Forum statistics

Threads
1,221,551
Messages
6,160,460
Members
451,648
Latest member
SuziMacca

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top