Auto Running a module !?

uk

Board Regular
Joined
Nov 4, 2003
Messages
101
I am trying to automate my access database to run first thing in the morning so it is has finished running by the time I get to work, I have set up a module -modRUN that runs all the queries and updates all the tables, the only problem is getting this module to run at the time I want.

I have figured two possible ways to do this, either

1] Create another module that will prompt the modRun to run at a certain time- I have no idea how to do this!

2] To use the Shedule task wizard - but this will only open the databse, it wont get the module to run!

Anybody got a solution?[/b]
 

Some videos you may like

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,975
Office Version
  1. 365
Platform
  1. Windows
2] To use the Shedule task wizard - but this will only open the databse, it wont get the module to run!

You are on the right track and are very close! I have done something like this, using method 2 you described above. Here are the key steps you are missing that will allow you to do it:

1. Set up your database to open a form automatically upon start-up.. Do this by going to Tools | Startup and select your form under the Display Form/Page textbox.

2. Call your macro in the Form_Load event of the form you are opening upon start-up.

Now, when the database is opened, it will automatically open the form you specified, and the Form_Load event will automatically call and run your code.
 

Philem

Active Member
Joined
Jan 2, 2003
Messages
282
Hullo. Alternately, you can modify the line to launch the database used in your Scheduled job, to run a given macro, by putting /X MacroName at the end.

HTH (y)

P
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,975
Office Version
  1. 365
Platform
  1. Windows
Hullo. Alternately, you can modify the line to launch the database used in your Scheduled job, to run a given macro, by putting /X MacroName at the end.

Philem, that's cool, I didn't know that. Does that just work with Macros, or can you call VBA code (Sub procedures stored in Modules) also?
 

uk

Board Regular
Joined
Nov 4, 2003
Messages
101

ADVERTISEMENT

um, how do you make the macro that will run the module?
 

uk

Board Regular
Joined
Nov 4, 2003
Messages
101
Apparently our IT Dep have decided not to allow us to use task shceduler !!!

Any one have a work around idea?


1] Create another module that will prompt the modRun to run at a certain time- I have no idea how to do this!
 

bat17

Well-known Member
Joined
Aug 15, 2003
Messages
1,470

ADVERTISEMENT

you can use the timer event of a form to run your code for you. Check out "Event Timer" in help

Peter
 

CT Witter

MrExcel MVP
Joined
Jul 7, 2002
Messages
1,212
To run code at the startup of the database, you can also use a macro titled "AutoExec" . Within this macro you can place any number of arguments (Open Form, RunCode, RunSQl,etc.)

HTH,
CT
 

Watch MrExcel Video

Forum statistics

Threads
1,123,531
Messages
5,602,202
Members
414,513
Latest member
junbuggle

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
Top