how to know if a form is a subform

  • Thread starter Thread starter Pierre
  • Start date Start date
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.
 
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
 
Back
Top