anandks42
06-23-2008, 02:10 PM
Hi,
I am trying a sample program to transfer contents from a delimited file into a table in access. This is the code I am using:
Sub importfile()
On Error GoTo ferrors
Dim db As database
Dim rec As Recordset
DoCmd.TransferText acImportDelim, , "tblDet", "C:\Anand\Ebook\practice\Access\test.csv", yes
Set db = CurrentDb()
Set rec = db.OpenRecordset("tblDet")
ferrors:
Debug.Print ("sub importfile: " & Err.Number & ": " & Err.Description)
End Sub
This is the error message I am getting:
sub importfile: 2391: Field 'F1' doesn't exist in destination table 'tblDet.'
tbldet has the following structure
Name Emp No Age
(and values for these fields)
This is what test.csv contains:
Name Emp No Age
(and values for these fields)
Please help me debug this error. Thanks!
I am trying a sample program to transfer contents from a delimited file into a table in access. This is the code I am using:
Sub importfile()
On Error GoTo ferrors
Dim db As database
Dim rec As Recordset
DoCmd.TransferText acImportDelim, , "tblDet", "C:\Anand\Ebook\practice\Access\test.csv", yes
Set db = CurrentDb()
Set rec = db.OpenRecordset("tblDet")
ferrors:
Debug.Print ("sub importfile: " & Err.Number & ": " & Err.Description)
End Sub
This is the error message I am getting:
sub importfile: 2391: Field 'F1' doesn't exist in destination table 'tblDet.'
tbldet has the following structure
Name Emp No Age
(and values for these fields)
This is what test.csv contains:
Name Emp No Age
(and values for these fields)
Please help me debug this error. Thanks!