determine if subform or not

  • Thread starter Thread starter Question Boy
  • Start date Start date
Q

Question Boy

I have a form with I call on its own and can also be part of another form as
a subform (but there are no child fields/master field links - simply inserted
within another form).

How can I determine if the form is being opened on its own or from the
'master' form?

Thank you,

QB
 
I figured out the I could use the Me.Parent.Name but it spit out an error
when the form is opened on its own. I can trap it, but is there a prefered
way to deal with this or is this the proper approach?

QB
 
Question Boy said:
I figured out the I could use the Me.Parent.Name but it spit out an error
when the form is opened on its own. I can trap it, but is there a
prefered
way to deal with this or is this the proper approach?

Proper AFAIC. Here's my function:

Public Function IsSubform(frm As Form) As Boolean
'Returns True if frm has a parent form
Dim s As String
On Error Resume Next
s = frm.Parent.Form.NAME
IsSubform = (Err.Number = 0)
End Function
 
Back
Top