Discussion:
"AutoClose" macro in Access
(too old to reply)
Helge V. Larsen
2005-08-24 10:30:35 UTC
Permalink
Excel has Auto_Open and Auto_Close VBA routines that are automatically run
when the workbook is opened and closed.

Access has an AutoExec macro that is automatically run when the database is
opened.
I need an equivalent "AutoClose" macro in Access - but this option does not
exist.

How can I run a macro or some VBA code when a database is closed ?
Beth Melton
2005-08-27 15:30:28 UTC
Permalink
Access only supports an AutoExec macro. What do you want your macro to
do?

Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
Post by Helge V. Larsen
Excel has Auto_Open and Auto_Close VBA routines that are
automatically run when the workbook is opened and closed.
Access has an AutoExec macro that is automatically run when the
database is opened.
I need an equivalent "AutoClose" macro in Access - but this option
does not exist.
How can I run a macro or some VBA code when a database is closed ?
Helge V. Larsen
2005-08-29 07:06:27 UTC
Permalink
I am developing an application that is used/tested by several others. The
general users/testers need some buttons on a toolbar that is part of the
application. But during the development I need some more buttons. These
buttons are added to the toolbar when the application is opened - if
Environ("USERNAME")=<My usercode>. When the application is closed I would
like to remove them again - if Environ("USERNAME")=<My usercode>.
Access only supports an AutoExec macro. What do you want your macro to do?
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.
~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP
Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
Post by Helge V. Larsen
Excel has Auto_Open and Auto_Close VBA routines that are automatically
run when the workbook is opened and closed.
Access has an AutoExec macro that is automatically run when the database
is opened.
I need an equivalent "AutoClose" macro in Access - but this option does
not exist.
How can I run a macro or some VBA code when a database is closed ?
Beth Melton
2005-08-29 13:35:46 UTC
Permalink
You could load a hidden form when Access starts and use its Unload
event to trigger your code. The way this works is if the database is
closed in any way the form will be unloaded.

Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
Post by Helge V. Larsen
I am developing an application that is used/tested by several others.
The general users/testers need some buttons on a toolbar that is part
of the application. But during the development I need some more
buttons. These buttons are added to the toolbar when the application
is opened - if Environ("USERNAME")=<My usercode>. When the
application is closed I would like to remove them again - if
Environ("USERNAME")=<My usercode>.
Access only supports an AutoExec macro. What do you want your macro to do?
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.
~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP
Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
Post by Helge V. Larsen
Excel has Auto_Open and Auto_Close VBA routines that are
automatically run when the workbook is opened and closed.
Access has an AutoExec macro that is automatically run when the
database is opened.
I need an equivalent "AutoClose" macro in Access - but this option
does not exist.
How can I run a macro or some VBA code when a database is closed ?
Loading...