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

Importing a text file to Access

P: n/a
I want to add a button to a form to import a text delimited file. The
File is delimited by "^" and so I have created a specification file by
manually impoting the text file, using the advanced button and saving
the specification.

Naively I thought I just needed to add the specification file name to
variable strSpec for the following command to work

DoCmd.TransferText acImportDelim, strSpec, strOutFile, strInFile,
-1
When i run this from the button there is an error message returned
which states the specification file does not exist but when doing this
manually it is still in the database.

Can anyone tell me how to get the command to find the specification
file or how to code it directly into the above command?

Thanks

Jun 14 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi, Phil.
When i run this from the button there is an error message returned
which states the specification file does not exist but when doing this
manually it is still in the database.
Most likely, the specification name is misspelled. Use Debug.Print to print
the strSpec variable to the Immediate window to see exactly what you're
passing to the TransferText method. If the specification name is spelled
correctly, then ensure that:

1.) strOutFile contains the table name you're importing into, and
2.) strInFile is the full path and file name you're importing the data
from, and
3.) the specification is saved in the current database file, not a library
database file or other open database file.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
Jun 14 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.