Because Form.Parent will raise an error if there is no parent, I commonly write a custom property on a subform as follows...
Property Get ParentName() As String
On Error Resume Next
ParentName = Me.Parent.Name
End Property
With the presence of such a property, you can now write code on the...