Charlotte Foust
cfoust at infostatsystems.com
Fri Mar 14 12:20:00 CST 2003
Hmmn ... That sounds NATURAL to me! <VBG>
Charlotte Foust
-----Original Message-----
From: Drew Wutka [mailto:DWUTKA at marlow.com]
Sent: Friday, March 14, 2003 9:50 AM
To: 'accessd at databaseadvisors.com'
Subject: RE: [AccessD] How do I tell if a form is opened as a subform or
not?
My wierd purposes? <VBG>
The hWnd property is the key to Windows development, in fact it's the
primary key! <grin>
Drew
-----Original Message-----
From: Gustav Brock [mailto:gustav at cactus.dk]
Sent: Friday, March 14, 2003 5:08 AM
To: John W. Colby
Subject: Re: [AccessD] How do I tell if a form is opened as a subform or
not?
Hi John
That's right. There are many variations on the error catching theme. Did
you see my two-liner on the same theme? Actually, I haven't paid much
attention to the hWnd property until I noticed that Drew uses it quite a
few places for his weird purposes.
Private Function IsSubform() As Boolean
On Error Resume Next
IsSubform = Me.Parent.hWnd
End Function
/gustav
> How about:
> 'IS THE FORM REFERRED TO IN THE PARAMETER (FRM) CURRENTLY LOADED AS A
> SUBFORM? Function ccIsSubForm(frm As Form) As Boolean
> Dim str As String
> On Error Resume Next
> str = frm.Parent.Name
> ccIsSubForm = (err = 0)
> On Error GoTo 0
> End Function
> If a form has a valid parent property then it is by definition
> embedded in another something. It may be in a tab control, or a form,
> but it will be
a
> subform.
> John W. Colby
> Colby Consulting
> www.ColbyConsulting.com
> -----Original Message-----
> From: accessd-admin at databaseadvisors.com
> [mailto:accessd-admin at databaseadvisors.com]On Behalf Of Gustav Brock
> Sent: Wednesday, March 12, 2003 2:17 PM
> To: Drew Wutka
> Subject: Re: [AccessD] How do I tell if a form is opened as a subform
> or not?
> Hi Drew
> I don't like at all coding where you rely on error generation. It may
> very well be quick and dirty code and some like that, but I try to use
> it as the last resort only.
> Previously I have posted this small function for the same purpose - it
> could have been for the benefit of Arthur "the static lover" as you'll
> see. It is not much larger than your code:
> <code>
> Private Function IsSubform() As Boolean
> Static booSubform As Boolean
> Static lngFormsCount As Long
> If lngFormsCount = 0 Then
> lngFormsCount = Forms.Count
> booSubform = StrComp(Forms(lngFormsCount - 1).Name, Me.Name,
> vbTextCompare)
> End If
> IsSubform = booSubform
> End Function
> </code>
> /gustav
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com