John W. Colby
jwcolby at colbyconsulting.com
Tue Dec 28 14:14:56 CST 2004
You need to check for me.parent. If that property contains something then it is a subform. If checking the property generates an error then there is no parent. Typically you can do something like: Function IsSubForm(frm as form) as boolean Dim str as string on error resume next str = me.parent.name if err = 0 then IsSubForm = true else IsSubForm = false endif End function This function is "compiled in Outlook" but I use a function pretty much like this so it should run pretty much as is. A subform's parent is a subform control by the way. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Tuesday, December 28, 2004 2:46 PM To: Access Developers discussion and problem solving Subject: [AccessD] Question about SubForms I have a tabbed form on which each tab contains a subform. One of these subforms can also be opened independently. It contains a form header which contains a "finder" (i.e. combo-box that does the find-thing). When it's opened as an independent form, I want the header to show, but when opened as a sub-form I want it to be hidden. Unsure of the syntax here. My OnOpen code simply says (so far) If IsSubForm(Me) Then ' various failed attempts go here End If The function IsOpen() is pretty much standard. Check the form's parent.name attribute. But I am unsure how to hide the header given a True response from IsSubForm(). TIA, Arthur -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.298 / Virus Database: 265.6.5 - Release Date: 12/26/2004 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com