determine if subform or not

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
 
Q

Question Boy

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
 
S

Stuart McCall

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top