scheduled task for access code?

joe789

Registered User.
Local time
Today, 13:11
Joined
Mar 22, 2001
Messages
154
Hey Folks,

I developed a access database program a while back for a non-profit government agency; the tool works just fine and simply accepts a user entered valid date and then the user hits a command button that transfers files to certain locations depending on date entered by the user. Is there a way to create some sort of timer so that this tool and the code within can be launched say every day at 12 midnight? I know that with .exe, .bat, batch files, and what not you can create a scheduled task that will execute the code without user intervention; however, is this possible with code in Microsoft Access modules, and if so, how would I accomplish that? If I found out how to automatically execute the code within the access file, I would just replace the user entered date with the system date to achieve the same goal. Any help would be greatly appreciated. Although if I needed to, I suppose I can use visual basic to create a .exe with the code and just use the scheduled task feature in windows to run that executable every day; but if something exists in Access I would rather use that instead.

Thanks,

Joe
 
Search this form for "task schedule" topics. Here's the summary. Look for specific articles to see what else is implied in the summary I give you below.

1. Using Access Help, look up the topic "Command Line" to see options. Focus on command line option '-X'

2. Build a macro that does what you want in the order you wanted it. The macro can run action queries, run code, transfer files to/from a location, etc. Be sure it ends with a QUIT action.

3. Test this manually from the command line before committing this to full automation. Get it right so that it is literally a single command-line action with no human intervention.

4. Build a new icon to run Access on the given database. Edit the icon's properties to add the -X macroname to the appropriate place in the command line. Test the icon to assure that it does exactly what you want it to do with a simple "launch" action. I.e. double-click.

5. Using windows task scheduler, schedule that icon at the time you want.
 
I always defer to the Doc Man in most matters, but let me throw this option out there, as well:

Build a form with a text box. On the Timer Event for the form write some code like this:

Me.timeBox = Time

If (Me.timeBox >= #23:59:59 PM# And (Me.timeBox <= #12:00:00 AM#) Then
DoCmd.RunMacro "basYourMacroName"
End if

Set the Timer to 1000
Now build a macro that performs the function you want, and put its name in the code above "basYourMacroName"

Create an Autoexec macro that opens the form.

Place a shortcut to the db in the Startup folder on the machine you want it to run from.

I've been using this basic setup for over 10 years to run an update to a table. It's only failed when the user failed to turn the computer on...:D
 
I always defer to the Doc Man in most matters, but let me throw this option out there, as well:

Build a form with a text box. On the Timer Event for the form write some code like this:

Me.timeBox = Time

If (Me.timeBox >= #23:59:59 PM# And (Me.timeBox <= #12:00:00 AM#) Then
DoCmd.RunMacro "basYourMacroName"
End if

Set the Timer to 1000
Now build a macro that performs the function you want, and put its name in the code above "basYourMacroName"

Create an Autoexec macro that opens the form.

Place a shortcut to the db in the Startup folder on the machine you want it to run from.

I've been using this basic setup for over 10 years to run an update to a table. It's only failed when the user failed to turn the computer on...:D

I've never tried the access ribbon routine, and am inherently non-trusting of msfts canned procedures.

plus, being a code-jockey, Friday's method is my method of choice. Or something quite similar to it.
 

Users who are viewing this thread

Back
Top Bottom