Discussion Locked

Access: Importing Data w/ VBA

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Using Microsoft Access 2000 VBA, I would like to import data from a text file to a table. The text file is updated weekly. Each week, I would like to clear the Access table and import the updated text file using an automated function such as VBA.

5 replies

by glen_mcleod

If you know the format of the file (delimited, fixed length, etc.) and it isn't going to change, then this should be relatively easy. Use the VBA Open command to open the file, read it into local variables on row at a time, then insert it into yourrable. Access doesn't have a 'Truncate table' statement like large RDBMS's but all you have to do is execute a delete query before you start inserting.

Glen

by donq

Build your "target" Access 2000 table exactly as the imported text is formatted and save it. Then in the same database create a delete query to clear existing data from the new table and then create an append query using your (Intranet or floppy?) text file as the data source.

Once all the parts start working properly save them in a single macro (or VBA procedure) and connect them to a button tht automates everything.

This discussion is closed to new replies.