Autoexecute when Access is open or closed

sinema

New Member
Joined
Jun 1, 2019
Messages
2
I have been looking for my original post or the post that I think I thought was mine but was someone else's.

Anyway, we have an access tool that someone else built. Each day I press a "Run All" button and 20 mins later I finishes and I continue. We are trying to have this run automatically a few times a day.

I just do not know how to make it happen. is it even possible?

Is there a resource to figure out how?

It's on a Form and when right click and select build event it will show the Form_Lookup Tasks and there's a section called "Private Sub cmdsyncrunall_Click()" that contains everything I want it t do.

I just do not now hw to make it run on a timer.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
You can automate Access databases a few different ways.

1. You can create a macro named "AutoExec". These will run automatically whenever a database is opened.
- or -
2. Set a Startup Form on your database (a Form that opens automatically whenever a database opens), and add VBA code that runs on the "Load" event of the Form.

Then you can use some scheduling software (i.e. Windows Scheduler) to open the database at specified times of the day, which should kick off your Macro/VBA code.

I typically make a second copy of the database that does this, so users aren't typically using the version which runs automatically.

There are other variations, such as calling a specific macro/vba code to run from the scheduler, such as the one shown here: https://office-watch.com/2017/scheduling-an-access-task/
 
Upvote 0
@sinema, you didn't say if this is a shared db. If there are concurrent users the action might disrupt what they're doing; maybe even introduce corruption. It seems like there must be a lot going on for it to take 20 minutes to finish. I would agree with Joe4 that a separate db might be best. Question is, what is the best way to initiate the action? A form timer will only work if that db is open. Another method would be to call the procedure from the db you are "continuing" in - provided that doesn't interfere with anyone.
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

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