Close current form on deactivate? (1 Viewer)

sasolini

Registered User.
Local time
Today, 07:50
Joined
Dec 27, 2004
Messages
61
Hey,

Can someone pls tell me how to close a form as soon as it gets deactivate? Becouse i try with Docmd.Close but it tells me that i can not do that in this event, but thats exactly what i would like to do - close form when it gets deactivated?

Thx
 
That does not make sense to do that.

In a command button OnClick event [or something else] you can call this code to close the form.

Code:
DoCmd.Close acForm, Me.Name
 
I know i can do that with a command button, but i dont want that...And it make sense, becouse i dont want users haveing two or more forms open.
 
How can your users have 2 or more forms opened?

If you have a menu system, a user clicks a command button to open a form and then clicks a command button to close the form and either return to the main menu or another form.

I agree with ghudson use command buttons.
 
In the OcClick event of your button to open the other form you need to also close the current form. This will do that...

Code:
    DoCmd.OpenForm "frmForm2"
    DoCmd.Close acForm, Me.Name
 

Users who are viewing this thread

Back
Top Bottom