Opening Access database from Batch File or VBS

CarlRostron

Registered User.
Local time
Today, 08:17
Joined
Nov 14, 2011
Messages
88
Is there a way to open an Access Database from a batch file or VBS file wait for 20 seconds and then close the Access file. Preferably I would like the Access file to run in either invisible or minimized mode. I would like the Access Database to close again after the 20 seconds has elapsed.

(The reason for this is so that the Database can refresh itself from Sharepoint on another users machine so that the excel reports on his machine are up to date).

Thanks for your help.
 
Google command line open access database. You can find a Microsoft support page with command line switches. You could use this to open your db and run a specific macro, the macro could be one which counts down and closes the db. Not sure whether you could minimise it though.
 
There is a way to do this using a .bat file, here's the very .bat file I use to run a database I use that refreshes a sql bakc end of another database
START C:\MSAccessEXE\MSACCESS.EXE C:\VSDB\VSDBrefreshVer.mdb
EXIT
This is run by a Windows scheduled task which you can set to run as you please. To get the database to close you need to write a Startup function which controls all the events you wish to run and then use Docmd.Quit, failing that you could run another .bat file (using Windows scheduled task) one or 2 minutes later using:
TASKKILL /F /IM "MSACCESS.EXE"
EXIT

NB to get Access to start, I had to copy the MSACCESS.EXE file to a different folder to the Office folder, so I created C:\MSAccessEXE and copied it there and it worked fine
David
 

Users who are viewing this thread

Back
Top Bottom