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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running code at startup via Autoexec macro 1

Status
Not open for further replies.

KerryL

Technical User
May 7, 2001
545
US
I created a macro called 'Autoexec' so it will run each time the DB is opened. I'd like it to run a simple piece of code, but I can't get it to work.

I thought that if I placed the code in a module called 'Global' it would find it by default, but apparently not. I also tried placing the code in a form and tried this line in the macro's Function Name box:

[Forms]![frmMainMenu]![ClearAppendAllTables]

But that didn't work either.


The subroutine is called "ClearAppendAllTables" and all it does is run a macro (which runs 6 macros in a specific sequence). How can I get my 'Autoexec' macro to run this little piece of code automatically each time the DB is opened?

Thanks in advance,
Kerry
 
You could create a simple form that displays on startup and in that form's onload event call the autoexec module that you wrote. Then close the form when the autoexec has completed. To display this form at startup go to Tools-->Startup and pick that form from the dropdown list.

 
Kerry.

if you create a macro called autoexec and get that to call the autoexec VBA code that works

 
ethorn10:
Duh, I didn't think of that. I already open the main menu form at startup, so I added the code to the OnLoad event and it works fine.

Thank you!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top