TransferText filed name

  • Thread starter Thread starter JIM.H.
  • Start date Start date
J

JIM.H.

Hello,
I use DoCmd.TransferText acImportDelim in my module to
import a CSV file which does not have a header. How can I
define the filed names in the table. They are F1,F2, ..
right now.
Thanks,
Jim.
 
You can't do it during the import process. I assume that you're letting
ACCESS create a new table during the import, and this is how it defines
fields unless there are header names in the text file's first row.

One option is to put a header row of data in the text file and use True for
the "HasHeaders" argument of TransferText.

The other option is to create a table with the desired field names, and then
import the data into that table.
 
-----Original Message-----
You can't do it during the import process. I assume that you're letting
ACCESS create a new table during the import, and this is how it defines
fields unless there are header names in the text file's first row.

One option is to put a header row of data in the text file and use True for
the "HasHeaders" argument of TransferText.

The other option is to create a table with the desired field names, and then
import the data into that table.
--
Ken Snell
<MS ACCESS MVP>


use same command(docmd....) but set up import spec
through file, get external, data import and name fields
here then in docmd put.....DoCmd.TransferText
acImportFixed, "ImpSpec", "validationorig", Forms!mainmenu!
IARRFile, 0

where "impspec" is saved import sepcification you set up
before and "validationorig" is table u want to import into
(with same field names setup)
and my Forms!mainmenu!IARRFile is the path of the file
that they have chosen in a combo box from a form to import
 
Back
Top