Text File conversion

S

Scott Neighbors

I am having to convert a text file to access each day, and
was looking for a way to automate the conversion. It is a
fixed width text file and takes some file to import. I am
hoping someone has an answer to this question?
 
J

John Nurick

Hi Scott,

Asssuming the file has the same columns every day but may have a
different names

1) as you're importing it manually, click the Advanced... button in the
Text Import Wizard and save the settings as an import specification.

2) create a module in your database and paste the code from
www.mvps.org/access/api/api0001.htm into it. This lets you use the
standard File Open dialog so the user can specify the file.

3) put a commandbutton on a form, and in its Click event procedure put
VBA code that displays the dialog to get the file name and then uses
DoCmd.TransferText with the filename, specification name and table name
to actually import the data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top