Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to automatically import data?

Status
Not open for further replies.

CTOROCK

Programmer
May 14, 2002
289
0
0
US
How can I append data from a txt file to one of my tables?
I have a script which exports a txt data table in txt format at a certain time through windows tasks. how can I schedule Access to automatically import the data at a certain time? And how do I append the data to a specific table instead of creating a new one or overwriting one?
Thanks in advance
Eric "The greatest risk, is not taking one."
 
docmd.transfertext.

you will need to create a specification to tell it where to put the text.

on the file > get external data > import
and continue as if you were going to manually import the text file. (You may have to change the extension to .txt temporarily so the wizard can find it). Select the file and hit import button. you will be presented with the first few records and you are supposed to select where each field ends. Instead, select the "advanced" button at the bottom and you will get a field grid to give it field lengths and start positions. set this up and save it (use the tablename concatinated with "spec" to keep things simple).
change the extension back and use the importtext command with this spec name and you should be good.
 
You could add the access db as a scheduled task, and create an autoexec macro to lauch code to do the import of the data and then close the db.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top