Closing Form from Subform (1 Viewer)

cjmitton

Registered User.
Local time
Today, 01:38
Joined
Mar 25, 2011
Messages
70
In my Main form (frm_Matters) I have a subform (frm_Others) in that form I have a button which opens a new pop up form (frm_Other_Business) but I then need to close the form that it came from (I.e the Parent form 'Matters').

I've used the code I usually use when opening / closing forms but as I'm running this from a subform (I'm guessing) its trying to close the subform instead of the parent so I tried the following but still not luck.

Code:
DoCmd.Close acForm, Form!frm_Matters, acSaveNo

Any thoughts please?
 

vbaInet

AWF VIP
Local time
Today, 01:38
Joined
Jan 22, 2010
Messages
26,374
Something like:
Code:
DoCmd.OpenForm "FormName"... etc
DoCmd.Close acForm [COLOR=red]Me.Parent.Name[/COLOR], acSaveNo
Leave the bit in red as it is.
 

cjmitton

Registered User.
Local time
Today, 01:38
Joined
Mar 25, 2011
Messages
70
Excellent, thanks for that. I thought I would have to be more specific!
 

vbaInet

AWF VIP
Local time
Today, 01:38
Joined
Jan 22, 2010
Messages
26,374
You're welcome!

Na, as long as you call the parent form it will be fine.
 

Users who are viewing this thread

Top Bottom