how to know if a form is a subform

P

Pierre

Hello,

In a form, I would like to test if the current form is independant, or if it
is used as a subform in a parent form.
I try testing "me.parent", but it generates an error when not is subform
mode.

Thanks.

Pierre.
 
B

Brendan Reynolds

Dim obj As Object
On Error Resume Next
Set obj = Me.Parent
On Error GoTo 0 ' or your error handler label
If obj Is Nothing Then
MsgBox "I'm not a subform!"
Else
MsgBox "I'm a subform!"
End If
 

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