Checking .NewRecord property on sub-subform - Invalid Reference

Viewed 28

I am running a vba subroutine to check the status of a sub-subform and see if it is a new or existing record but I get an error message telling me "Run-time error '2455': You entered an expression that has an invalid reference to the property Form/Report." I started with this code:

If Forms!MainForm!Subform1.Form!Subform2.Form.NewRecord then debug.print "New" Else debug.print "Existing" End If

I also tried:

If Forms!MainForm.Form!Subform1.Form!Subform2.NewRecord then

If Forms!MainForm!Subform1!Subform2.Form.NewRecord then

If Forms!MainForm!Subform1!Subform2.NewRecord then

But still no luck. I've always found this page very helpful in referencing things in Access but this time it doesn't seem to be enough. Am I just missing something very simple?

1 Answers

It should be:

If Me!NameOfSubformControl1.Form!NameOfSubformControl2.Form.NewRecord Then 
     Debug.Print "New" 
Else 
     Debug.Print "Existing" 
End If
Related