Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create AutoExcecuting Macro (no user intervention)

Status
Not open for further replies.

AccUser

MIS
Joined
May 11, 2000
Messages
96
Location
US
Question: Is possible to create a macro in an Access database that will execute itself at a specified time?

For example, I have a query that adds new records from one table into another. Unless I open the database and execute the query, it doesn't get run. So, I created a macro and Saved As Desktop Shortcut that SetWarnings to No, launch the query, and Quit. If I remove Quit, it runs fine. Otherwise, the following:

Problem 1: Get error message when exiting "Cannot find the file 'C:\Windows\Desktop\Shortcut to MakeNewCust in database.MAM' or one of its components. Make sure that the path and filename are correct and that all the required libraries are available."

Problem 2: I don't want to execute this macro manually. I would like to have it execute itself daily, say at 6AM when no one is using it.

Any takers?

Thank you in advance.
ER
 
If you do not get an Access solution here, consider using VB and your Server's scheduler. I do this all the time. It is very easy to create a small VB .exe, which opens a connection, executes an ADO/RDO/DAO function, makes a log entry (an important item to perform), closes the conection and terminates.

If you do not have VB, I would consider creating the .exe for you. If I can do it, using one of my current templates, I would be happy to do so.

Cheers
Steve
SteveAndEdie1@attbi.com
stevem@nuprecon.com
 
I developed this solution so far, but it runs from Win9x box. I created a shortcut on my desktop.

In the Target area, I placed "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "ServerPath\ServerDirectory\DatabaseName.mdb" /x NameOfMacro.

I tested by double-clicking on this shortcut. Access opens, macro is launched, Quit command in macro exits Access.
I then created the schedule in the Task Scheduler.

Works great, but will it not execute from the NT Box. I tried creating the batch file (Notepad) and it works if I manually click it. But doesn't launch using AT command.

Still working on it. Am willing to investigate VB code (dont' have VB, though).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top