Can Access 97 run a module at a particular time?

Marko Stojovic

Registered User.
Local time
Today, 08:08
Joined
Jan 25, 2001
Messages
29
I would appreciate it if anyone could advise me on how to implement this, if it is possible...

Thanks!

Marko.
 
Mike,
I had a look at the notes that you gave me a link to. I'm having a bit of trouble with the task scheduler, maybe because I've got Windows NT4. 'Help' says that the service Net Start Schedule can be used to get tasks performed at a particular time. It says to use the 'at' command, but this command doesn't seem to take a filename!

Is this the service that was being referred to? Do you have any ideas on what I should do to schedule the service?

Marko.
 
I'm not familiar with NT, but most schedulers seem to want you to pass them a command-line type of string, so you might need something like:

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" C:\mydocu~1\mydb.mdb

or

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE C:\mydocu~1\mydb.mdb"

or maybe just without the quotes altogether.

If you still have problems, I would give up on NT's own scheduler and download a freeware one (there must be hundreds of them out there and they will all be pretty the same as the one that comes with Win98

Mike
 
Your description leaves out some things regarding what you want to do, but it is possible that the strict answer is a qualified "No" - unless certain conditions are met first. Because of course, if Access is not running at that time, the answer is a guaranteed NO.

It might be possible to write a VB program that activates some module within a database but that wouldn't be Access doing it. You can run one of those in the scheduler.

You MIGHT (emphasize MIGHT) be able to do something like start Access against a particular database through a command-line option, then have that database set up to have a default startup form. Then you could run the module on the OnLoad or OnCurrent event for the startup form, which might include whatever it was you wanted to run PLUS code to cause Access to exit after it finished the task.

Let's just say I wouldn't be happy if I were given that project on a short fuse, 'cause it just ain't an easy thing to set up under Windows NT. (Yes, I run NT Workstation on the machine from which I am responding right now.)
 
I have time base events occuring in some of my access programs. They do require access to be open at the time, however, I instruct my users to leave them open.

My work around is:

Set up a form called frmTime this has a caption box, which displays Now(). In the on timer event is where the code resides. this form is set to refresh at 1000 timer interval property.

When my switchboard opens this form is opened, minimized and hidden.

In the switchboard form, or any other I simply tell the software if frmTime =time as variant then do something, usually a MsgBox.
 
I've got a couple of applications that I run on a scheduled basis (one, a reporting application, runs every hour during the working day, the other, a data harvesting application, runs in the middle of the night)

The first one I wrote quite a long time ago and it uses an 'autoexec' macro to run a bunch of queries, email some reports and shut itself down.

The second one I wrote after/while learning VBA, it uses a startup form, with some code in the OnLoad event, at the end of the code, it uses Docmd.Quit to shut itself down.

Both of them are scheduled using Win98 scheduler, as detailed above; the only problem I've ever had with them (since setting up, which was a bit fussy due to the command line fiddly bits) was when I used to run the regular one every twenty minutes; if our network was busy, the application wouldn't finish running it's queries (there are more than 50 of them (they all query different tables and couldn't be consolidated) and they are quite complex/slow) before the scheduler tried to launch it again, causing lock violations and the like, so I changed it to hourly running and no problems ever since.
One day I'm going to rewrite it in VBA, but not today.

It is possible to do without the scheduler idea and use a timer event in a form, but that requires the database to be open constantly, you would also need to do a bit of coding to avoid triggering a scheduled event more than once or not at all, whereas in (most of) the ready made task schedulers, it's all done for you andis usually pretty solid.

Mike
 
It easy to run a module as a scheduled event as follows:

1)Create a macro that uses the RunCode action to call your module.

2)Create a batch file to open access, call the macro(that calls the module), and close access.

the .bat file would look something like this
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "C:\mydocuments\mydb.mdb" X/macroname

create the .bat in notepad and save as filename.bat

then you can run the .bat file from any scheduler on a windows system.

I do this all the time and it works flawlessly!
 
Thank you all for your advice. A range of possibilities to try out here! I still have something bothering me, but I've posted it as a new message because It's probably more likely to get a response that way... Thanks again.
 

Users who are viewing this thread

Back
Top Bottom