Import csv file to Access 2003 table

D

Domw001

I am trying to import a 2-column csv (server_data.csv) file into an Access
table.
The CSV holds a server name and it's IP address
e.g.
server001,10.136.193.226
server002,10.136.193.227

I am using the following code:

DoCmd.TransferText acImportDelim, , "RDP_ILO", "C:\server_data.csv", False

CurrentDb.TableDefs("RDP_ILO").Fields("F1").Name = "Server_Name"
CurrentDb.TableDefs("RDP_ILO").Fields("F2").Name = "Server_IP"


The process works but the IP address is treated as a "Currency" data type so
instead of 10.136.193.226 i get £10.14


If I create an empty table with the correct field data type and run the Get
External Data wizard it imports fine.

Any ideas?
 
D

Douglas J. Steele

Try creating a specification and using it (as the second parameter) in the
TransferText method.

To create a specification, import the data manually. When the Import Text
Wizard appears, click on the Advanced button in the bottom left-hand corner,
and once your specification is complete, click on the Save As button in the
upper right-hand side.
 
J

Jim Burke in Novi

Also, while in the Advanced tab, make sure you have the data type for your IP
field set to Text.
 

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