472,127 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

Import with TransferText

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
4 9333

"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
"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
Danny, it helps a bundle. Many Thanx.
Nov 12 '05 #4
Danny, it helps a bundle. Many Thanx.
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Vladislav Moltchanov | last post: by
1 post views Thread by David Berry | last post: by
3 posts views Thread by Henrootje | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.