OK this is probably kind of complex, and perhapse the question is better placed in a different message board.
I wish to be able to run a VB module within an Access database once a day as if using a cron job without having to keep any copy of Access running continuously. ie the cron job should at a particular time every day open Access, run the VB module and then close Access once completed.
I recognise this may not be best resolved on SFLM, so my other more SFLM question is, where would be good resources to find this sort of information, or good places where this question might be asked?
This is really more of a Windows question than an Access one. You might want to retitle it something like “Does Windows have a cron equivalent?”.
Thanks, it is a bit of both, I think. The cron part could probably be sorted with a home built demon if the functionality doesn’t exist allready. But how does one start an Access macro from a non-Access process? Or where should I look to find this sort of thing out?
It is possible to do but it is not quite as stable or fault-tolerant as the way you would do it on other systems that are built for this kind of thing.
- Create a text file called “yourbatchfilename.bat”.
- Enter something similar to C:\Program Files\Microsoft Office\Office
Msaccess.exe C:\YOURDATABASEFILE.mdb /x YOURMACRONAME. This should reference the path where your Access application is stored followed by the path where your Access database file is stored. If you don’t have a macro, create one first. It’s job should be to run the VB code. - Save the batch file.
- Go to Start, Accessories, System Tools, Scheduled Tasks and make a schedule file that kicks off the batch file whenever you want.
You can run into problems with Windows user logins like this and it is possible to work around them but that requires some additional VB coding. I will leave that part out for now because it may not apply to you.