jwcolby
jwcolby at colbyconsulting.com
Wed Jan 21 11:48:29 CST 2009
Well... From code in the subform... me.Parent!MySfrmCtl.SourceObject = "" Me.Parent gets you to the parent object of the subform. !MySFrmCtl (whatever your subform control name may be) references the subform control that contains the current subform. .SourceObject references the property that needs to be set to the empty string. . (dot) should always be used for properties, ! (bang) should always be used for controls. You should test the me.parent from inside of the subform however. I have seen instances where me.parent did NOT refer to the parent form, but instead to a tab control which the subform control is on. Other than that specific issue, me.parent has always referred to the parent form. It seems that me.Parent really refers to whatever the control is on, which is USUALLY a form, but which may be a tab control. Even if it is the tab control though, the subform control will still be on the tab so me.parent!mysubformctl should still get you to the subform control. John W. Colby www.ColbyConsulting.com William Hindman wrote: > ...yes JC, but how do I do that from the subform? > > William > > -------------------------------------------------- > From: "jwcolby" <jwcolby at colbyconsulting.com> > Sent: Wednesday, January 21, 2009 11:41 AM > To: "Access Developers discussion and problem solving" > <accessd at databaseadvisors.com> > Subject: Re: [AccessD] subform close > >> The main form has a subform control on it, which hosts the >> subform. that cpontrol has a "source object" property. >> that property has to be set to a zero length string to cause >> the subform to unload. >> >> John W. Colby >> www.ColbyConsulting.com >> >> >> William Hindman wrote: >>> ...subform hosted on non-linked main form >>> >>> ...command button on subform >>> >>> DoCmd.Close ...button animates but form doesn't close >>> >>> ...thinking that I'm probably going to have to set the mainform subform >>> sourceobject to "" or another object and clean up anything on the open >>> subform such as dirty data before I do it. >>> >>> ...anyone done this and have tested code or suggestions? >>> >>> William >>> >>> >>> >>> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >