Max Wanadoo
max.wanadoo at gmail.com
Fri Jan 23 07:10:10 CST 2009
Yes, you could use this and call it, but it would achieve the only the same result. Attempt to call the me.parent and trap the error. >> Private Function AmIASubForm() As Boolean >> On Error GoTo ErrorHandler >> Dim varTemp >> varTemp = Me.Parent >> AmIASubForm = True >> Exit Function >> ErrorHandler: >> Err.Clear >> AmIASubForm = False >> End Function Max -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: 23 January 2009 07:35 To: accessd at databaseadvisors.com Subject: Re: [AccessD] subform close ...solved Hi Max It is the same thing. If in doubt, just read down a bit at that link. /gustav >>> max.wanadoo at gmail.com 22-01-2009 20:40 >>> Hmm. Not sure we are talking 'bout the same thing. I *think* the best option is just to trap the err.number and handle it. On error goto errhandler <code> If me.parent!ctlname = xys then ' oops no parent bombs down to errhandler <code if parent> Endif Goto jump noParent: <code if no parent> Jump: <more code> Goto exithere Exithere: Exit function/sub Errhandler: Select case err.number Case xyz 'handle no parent Case else Msgbox "Diabolical error - call yourself a programmer" End select resume exithere Max (all air code of course - you don't need examples) -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: 22 January 2009 14:19 To: accessd at databaseadvisors.com Subject: Re: [AccessD] subform close ...solved Hi Max Reminds me ... we were around that back in 2003: http://databaseadvisors.com/pipermail/accessd/2003-March/003498.html /gustav >>> max.wanadoo at gmail.com 22-01-2009 10:14 >>> Hi William, If there is ever going to be a case where the subform is opened as a main form in its own right then you might want to put a test in there to see if there actually is a "Parent" object. In some of my cases, I have it as a sub and a main with some me.parent code in there. Using Stuart's function to pass args could be utilised along with Rocky's parsing system. Cool eh? Max -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com