I have a Form that includes a Sub-Form. I want to reference one of the fields within the RecordSource of the Sub-Form. Within the code-sheet of the Form, a Public Function is called via a right-click popup menu. A snippet screenshot (below) of the "open" Sub-Form is shown with the record-selector highlighted on the record of interest.
The following code produced the error shown above: (Note: "FamilyDetailsSubform" is the name of the Sub-Form, NOT the container control.)
Code:
Public Function DelPseudoMbr()
Dim lngFormRec As Long
lngFormRec = Forms!FamilyDetailsSubform.Form!RegistryID
Debug.Print lngFormRec
End Function
The Sub-Form is obviously Open so that's not the issue. While query/table field "RegistryID" is not bound within the Sub-Form, I don't think Access got that far anyway so I don't believe that's an issue.
Am I missing something in the syntax of the failing assignment statement?