"khutch" <kv*****@yahoo.co.uk> wrote in message
news:ca**************************@posting.google.c om...
Not that up on MS Access. I understand that the TransferText command
can be used to import csv files into a database. Question: Does the
text file have to mirror the alignment of the table columns e.g. must
field1, field2, filed3 etc correspond to col1, col2, col3 on the
table? or can I state somewhere which columns in the text file
correspond to which table columns. I actually need col1, col2, col5
and col6 from the text file to populate col1, col2,col3 and col4 in my
table. Checked the help files but only got more confused, being only
an amateur programmer. Examples would help. Many many thanks
I guess I would use this
DoCmd.TransferText acImportDelim, "inputspec", "mytablename",
"thecsvfile.csv", True
the inputspec is something you can use to tell the command which fields to
skip, and also you can rename the field names.
So I guess you can do what you want. You can tell it to import col1 as
col1, col2 as col2, skip col3, skip col4, col5 as col3, col6 as col4.
set the import spec up manually when you do the file-import- then in
advanced options you can save your spec to use in code like above later.
or if not, import the whole thing and then do a make table query selecting
the fields you want and naming then what you want.
Does this help?