Link to home
Start Free TrialLog in
Avatar of scurvylion
scurvylion

asked on

Using VB script to run Access macro at specific time

Hi,

This is part of a project that I am doing. I am at the stage where I have successfully automated the import of .csv files into an Access database (with lots of help from EE). Now I want to automate the process so that every night at say 2:00 AM a VB script runs and opens the Access 2007 database and runs a macro (which calls the VBA code to update the database) and then closes.

I believe that this should be pretty easy to operationalize but I have no experience working with VB scripts at all so any help that I can get would be most appreciated.

Thanks,
scurvylion
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of scurvylion
scurvylion

ASKER

Hi capricorn1,

It ran great but the database didn't close and the svchost.exe continued to run. is there another command that I need in this script file or is the error in my VBA code in the macro?

scurvylion
if your vba codes does not include to close the application

docmd.quit   ' you can add this at the end of the vba code

or

in the macro

action
runcode
quit           'add this
Works great! Thanks for your help - appreciate it very much!
Thanks!!