By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,125 Members | 1,411 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,125 IT Pros & Developers. It's quick & easy.

Import with TransferText

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"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?

Nov 12 '05 #2

P: n/a
"Danny" <da********@hotmail.com> wrote in message news:<dX********************@news4.srv.hcvlny.cv.n et>...
"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?


If you have problems using the Access import facilities you could try
our new product Super*SQL which can load ASCII files directly into an
Access database. You can specify the columns in any order and any
columns not specified will be set to null. Super*SQL is in Beta
testing so is free to use. For more information visit
www.sqlmagic.com.
Nov 12 '05 #3

P: n/a
Danny, it helps a bundle. Many Thanx.
Nov 12 '05 #4

P: n/a
Danny, it helps a bundle. Many Thanx.
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.