Close master form from subform??

aweizd

Registered User.
Local time
Tomorrow, 00:10
Joined
Apr 8, 2005
Messages
12
Hi,

I have a form with a subform. In the subform (based on a different form) I need a button to close the master form. In the subform I need to find out what the master form is so I can close it. Since I use the same subform in multiple forms I can't really hard code the name of the master form.

Can someone help me?
Thx
Luke
 
here's one way...

Using the OnLoad event of the main form set the Tag property of the SubForm like this

Me!SubformName.Form.Tag = Me.Name

..put your Close command button on the subform and set the OnClick event to:

varForm = Me.Tag
DoCmd.Close acForm, varForm, acSaveYes
 

Users who are viewing this thread

Back
Top Bottom