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

macro on startup

Status
Not open for further replies.

techsupport3977

Technical User
Mar 7, 2005
56
US
I need to execute a macro everytime the mdb application opens. What function can I call to make this happen?
 
you can either make a macro and call it autoexec. whenever access starts, it will automatically run this macro first.

another option is on the menu option of 'tools' go to 'startup' and choose your opeing form in 'display form/page'. Select your main form that you want displayed when the database opens, and on the properties of this form for on load, you can select a name of a macro.
 
Excellent!!

Now what about the opposite? I need to execute a macro or a VBA when the application closes. What should I do?
 
Hi!

If you have a form that remains open all of the time that the application is open then call the macro from the close event of the form. If you don't have such a form, create on and open it in hidden mode from your autoexec macro.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
that's easy also. look at the properties for your form, you will see an on close event. just make your macro, and select it for that event.
 
I know how to set the close on a particular form. I am asking about the application closing. You know, when someone clicks the 'X' at the right upper corner of the screen and closes the application. I need a macro or a VBA to execute.
 
Hi!

That is why we recommend using a form that remains open at all time. I prefer the hidden form method that I described because the user won't close it early. The hidden form will automatically be closed by Access when the application is closed and therefore the form's close event will run the macro as needed, when the application closes. As far as I know the application itself won't run any macro automatically on closing like the autoexec does on opening.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top