G
Guest
Access 2000 and 2003
Hi,
I'm importing a several hundred tab delimited text files with column names
in the first row, into an existing table. The columns in the text files are
in no particular order, presumably because the first row should determine
which column the data should belong in.
I have an import spec saved and I effect the import using:
DoCmd.TransferText acImportDelim, strTableType & "_spec", "stg_" &
strTableType, fd.Path & "\" & fl.Name, True
The problem I have, seems to be that the import spec is not taking any
notice of the order of the columns in the text file as determined by the
first row. However, if I try and import without the spec parameter listed in
the code, (like so)...
DoCmd.TransferText acImportDelim, , "stg_" & strTableType, fd.Path & "\" &
fl.Name, True
....the DoCmd.TransferText method does not seem to know that the file is tab
delimited, and I get the error message "Field
[fld_blah1_fld_blah2_fld_blah3] doesn t exist in destination table
[tblBlah]"
Any ideas? The key points are:
The field names are in the first row of the text files
The columns of the text files are in no particular order
The data are imported using docmd.transfertext
The data go into an existing table
Regards
GPO
Hi,
I'm importing a several hundred tab delimited text files with column names
in the first row, into an existing table. The columns in the text files are
in no particular order, presumably because the first row should determine
which column the data should belong in.
I have an import spec saved and I effect the import using:
DoCmd.TransferText acImportDelim, strTableType & "_spec", "stg_" &
strTableType, fd.Path & "\" & fl.Name, True
The problem I have, seems to be that the import spec is not taking any
notice of the order of the columns in the text file as determined by the
first row. However, if I try and import without the spec parameter listed in
the code, (like so)...
DoCmd.TransferText acImportDelim, , "stg_" & strTableType, fd.Path & "\" &
fl.Name, True
....the DoCmd.TransferText method does not seem to know that the file is tab
delimited, and I get the error message "Field
[fld_blah1_fld_blah2_fld_blah3] doesn t exist in destination table
[tblBlah]"
Any ideas? The key points are:
The field names are in the first row of the text files
The columns of the text files are in no particular order
The data are imported using docmd.transfertext
The data go into an existing table
Regards
GPO