M
mmarch-at-direct-dot-ca
Here is a strange observation about quiting Access 2000.
If you have code to run in the Unload or Close events
of the main form (switchboard):
(a) Using the Access menu Exit or window "X":
The code will run okay.
(b) Using a "Quit" command button on the main form:
Previously defined public or private variables will be gone!
The Unload and Close events fire, but string variables
to be used in these events are reduced to "".
The following VBA quit methods have been tried under the
Quit button, all with the same result:
Application.Quit
DoCmd.RunCommand acCmdExit
SendKeys "{F10}", True : SendKeys "F", True : SendKeys "X", True
So it seems any means of quitting Access from VBA code will
result in losing variables before you get a chance to use
them in the closing events.
If you have code to run in the Unload or Close events
of the main form (switchboard):
(a) Using the Access menu Exit or window "X":
The code will run okay.
(b) Using a "Quit" command button on the main form:
Previously defined public or private variables will be gone!
The Unload and Close events fire, but string variables
to be used in these events are reduced to "".
The following VBA quit methods have been tried under the
Quit button, all with the same result:
Application.Quit
DoCmd.RunCommand acCmdExit
SendKeys "{F10}", True : SendKeys "F", True : SendKeys "X", True
So it seems any means of quitting Access from VBA code will
result in losing variables before you get a chance to use
them in the closing events.