The easiest way would be to set the focus to the mainform and then do the docmd.
You are also supposed to be able to use

If Me.Dirty Then
Me.Dirty = False
End If

or possibly from the subform

If Me.Parent.Dirty Then
Me.Parent.Dirty = False
End If