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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically import data into access daily

Status
Not open for further replies.

Jennpen1

Technical User
Sep 4, 2002
57
US
I am working on a database that is being placed on a server to be used by 150 people or so. They are only permitted to view the data, and cannot change it. The problem is that this data is frequently changed by other sources and needs to be imported into the database on a daliy basis. I only want to import this data once a day, therefore I do not want to use an AutoExec macro. The users will be looking at this database at various times a day and most likley at the same time, so I cannot have the data being updated everytime the database is opened. Is there anyway I can have the data imported automatically at the same time everyday? I already have it set up so that when a button on the switchboard is pressed the data is imported, so I assumed that there is some kind of code that could run the import macro daily. I am in desparate need of some help, so I would really appreciate any advice one could offer.

 
I use Windows Task Scheduler. If you want Access to open using a specific macro, then use the /x switch. The command to launch your database would be something like this:

"path\msaccess.exe" "path\yourdatabase.mdb" /x macroname
 
This sounds like it is the same thing as using the AutoExec macro in Access. The problem is that I am not going to be the one using this database so I cannot be the one to update it daily. I need the macro to run only once a day, and it would be run by the first person to use the database that day. Then it would not run again until the first person opens it the next day. Thanks for your suggestions though.
 
In order to do what you want, you are going to have to set up a table with at least one field. That field will indicate the date/time the last import was done. Then, when a user logs on, you open the table and check the field to see if the import was done "today". If not, then import the data.

However, why can't you have the import run automatically (say at 12:01 am). My suggestion in the previous post was not referring to the AutoExec but another macro that would only be run by the task that runs automatically every night. There is no user interaction here. Windows Task Scheduler is responsible for running your database for you at a specified time.

 
Thank you BennyWong and FancyPrairie!!!!


Both of these solutions will work great. I appreciate the help so much.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top