Importing a .CSV file

S

Steve Roberts

I have a .csv file that I imported using the FILE->GET EXTERNAL DATA->IMPORT
and had it create a new table(no primary key created). I then Purged all the
data in the new table and tried to use the following code to do the import
using VBA:

DoCmd.TransferText acImportDelim, , "PCOUNTERLOG",
"N:\Database\Pcounter\PCOUNTERLOG09_2005.csv, False,

When I run the code I receive an error "Run-time error '2391': Field 'f1'
doesn't exist in destination table 'PCOUNTERLOG'

If I exit that then try the import usign the FILE->GET EXTERNAL DATA->IMPORT
method it works fine.

I tried changing all the fields to text, adding a primary key but that
didn't seem to help either.

Here is a sample of a typical line of data in the file:

test\patrickt,Untitled-1,\\PRINTSVR\SAVINC3828,08/01/2005,10:15,\\PTRAHERN,00004A27,,Letter,/C/Jt=2/Cp=1/Mt=PLAINORRECYCLED/Ts=42EE4A86,2936347,1,0.09,0.00

Any ideas?

Thanks

Steve
 
G

Guest

Check and see if you have any data in a column that has no column name.
Access defaults to naming unlabeld columns as Field1, Field2, etc.
 
J

John Smith

Steve Roberts said:
I have a .csv file that I imported using the FILE->GET EXTERNAL DATA->IMPORT
and had it create a new table(no primary key created). I then Purged all the
data in the new table and tried to use the following code to do the import
using VBA:

DoCmd.TransferText acImportDelim, , "PCOUNTERLOG",
"N:\Database\Pcounter\PCOUNTERLOG09_2005.csv, False,

When I run the code I receive an error "Run-time error '2391': Field 'f1'
doesn't exist in destination table 'PCOUNTERLOG'

If I exit that then try the import usign the FILE->GET EXTERNAL DATA->IMPORT
method it works fine.

I tried changing all the fields to text, adding a primary key but that
didn't seem to help either.

Here is a sample of a typical line of data in the file:

test\patrickt,Untitled-1,\\PRINTSVR\SAVINC3828,08/01/2005,10:15,\\PTRAHERN,0
0004A27,,Letter,/C/Jt=2/Cp=1/Mt=PLAINORRECYCLED/Ts=42EE4A86,2936347,1,0.09,0
..00

Any ideas?

Thanks

Steve
 
J

John Smith

Steve Roberts said:
I have a .csv file that I imported using the FILE->GET EXTERNAL DATA->IMPORT
and had it create a new table(no primary key created). I then Purged all the
data in the new table and tried to use the following code to do the import
using VBA:

DoCmd.TransferText acImportDelim, , "PCOUNTERLOG",
"N:\Database\Pcounter\PCOUNTERLOG09_2005.csv, False,

When I run the code I receive an error "Run-time error '2391': Field 'f1'
doesn't exist in destination table 'PCOUNTERLOG'

If I exit that then try the import usign the FILE->GET EXTERNAL DATA->IMPORT
method it works fine.

I tried changing all the fields to text, adding a primary key but that
didn't seem to help either.

Here is a sample of a typical line of data in the file:

test\patrickt,Untitled-1,\\PRINTSVR\SAVINC3828,08/01/2005,10:15,\\PTRAHERN,0
0004A27,,Letter,/C/Jt=2/Cp=1/Mt=PLAINORRECYCLED/Ts=42EE4A86,2936347,1,0.09,0
..00

Any ideas?

Thanks

Steve
 
J

John Smith

Steve Roberts said:
I have a .csv file that I imported using the FILE->GET EXTERNAL DATA->IMPORT
and had it create a new table(no primary key created). I then Purged all the
data in the new table and tried to use the following code to do the import
using VBA:

DoCmd.TransferText acImportDelim, , "PCOUNTERLOG",
"N:\Database\Pcounter\PCOUNTERLOG09_2005.csv, False,

When I run the code I receive an error "Run-time error '2391': Field 'f1'
doesn't exist in destination table 'PCOUNTERLOG'

If I exit that then try the import usign the FILE->GET EXTERNAL DATA->IMPORT
method it works fine.

I tried changing all the fields to text, adding a primary key but that
didn't seem to help either.

Here is a sample of a typical line of data in the file:

test\patrickt,Untitled-1,\\PRINTSVR\SAVINC3828,08/01/2005,10:15,\\PTRAHERN,0
0004A27,,Letter,/C/Jt=2/Cp=1/Mt=PLAINORRECYCLED/Ts=42EE4A86,2936347,1,0.09,0
..00

Any ideas?

Thanks

Steve
 

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