automated daily run of macro

stafire_18

Board Regular
Joined
Dec 8, 2004
Messages
162
Hi,
I am trying to find out if I can automate an access database macro to automatically run once a day without having to open the database. I don't use Access that often but am trying to automate a process for a website. If anyone has any clue as to how I can do this please help me. If you would like more information I'd gladly provide it, Thankyou.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Search this forum. I just explained this very same issue for someone else... within the last month or so.

Create a new, blank db.
Create a form that when opened, will run your macro, then exit.
Set the form to open when the database is opened.
Put entry in Scheduler to start this database at whatever time you want it to run.
 
Upvote 0
what if i need people going in & out of the form all day? this wouldn't work then correct because it will continue to run the macro over & over?
 
Upvote 0
I don't believe there is ANY way you can run an Access macro without first starting Access and opening the database that contains that macro. (Doesn't mean it nothing exists)

You could create code VB code to do what you're asking, but then, you wouldn't be running an Access macro.

My suggestion did not mention your current database, although, depending on what your macro does, you would probably need to recreate at least part of your database.

Let's say your macro runs one query which creates a new table, populating it with records from that query, then exports that table to an Excel file. You can create another - totally seperate database, link the required tables from you existing database, copy the query and the macro to this new database. Then, you create a totally new form... simply a blank form, that when it opens, runs the macro. When the macro is done, the form closes and the application exits. You then set up whatever scheduling program you use so that this new database is opened at a specific time - specified by you. When it opens, the form opens, the macro runs, the form closes and the application is exited. This takes no longer than the time it takes to run your macro normally. Your users would never open this database.
 
Upvote 0
You can also, using the same database, pass to the database a parameter on the command line used to start the database. It would be the /cmd parameter (Look up Command Line in help). It will take your macro executing a function (which a macro can do) to retrieve the command parameter to see if this is the open that will finish running the macro assigned to a form when the form is opened. Actually, because this macro will at least start every time the database is opened, this macro can be named AutoExec so it will run whenever the database is opened.
HTH,
 
Upvote 0
I have auto exect running a bunch of "clean up" tables & queries. Is there a code that says something to : if this form or databas is open prior to (example time) 12:00pm then run macro. or something to that effect? but only if it is open prior to 12:pm on a daily basis.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top