Firing an Event on MS Access exit

G37Sam

Registered User.
Local time
Tomorrow, 02:40
Joined
Apr 23, 2008
Messages
454
Hi,

I would like to know if there's a way one can launch an event when MS Access is closed (hitting the outermost close button)

Regards,
Samer
 
One typical method is using the unload event of a form that would always be open. There is no event on the program itself closing.
 
As Paul mentions, I typically will have a hidden form that is open and in its UNLOAD event I will put whatever I want, including code that will ask the user if they really wanted to close the database and setting Cancel = True if they did not, thereby keeping the database open if the close X at the top of the screen was used.
 
On the link above, I get the error

user-defined type not defined on the line

Code:
Dim c As CloseCommand]

when I open my database?
 
Never used it, but is that bracket really in your code?
 
Did you follow the steps correctly?? As the Step 6 says..
On the File menu, click Save (to save the project), and when prompted for the name of the class module, save it as CloseCommand.
So if you save it as such I think the compiler Error will not occur..
 
I checked all that. I now get an error

'the expression you entered has a function name that Microsoft access can't find'

when it runs the InitApplication() function.
 
So the Function InitApplication() is on a Standard Module, and the other Procedures like Get Enabled() and Let Enabled() are in a separate Class Module?
 
Ah, I had the module types the wrong way round. Thanks.
 
Yea, I have done something similar to that in the past, so thought it might be case here too.. :D

Good luck.. :)
 

Users who are viewing this thread

Back
Top Bottom