I have an Access database with a Form that, once the EmployeeID is double-clicked, then it opens another form that contains a subform with employee information. I obtain the EmployeeID from the original form with this code...
myID = CInt(Me.OpenArgs)
I use this string on my secondary form and the subform contained within, however, it is not picking up the EmployeeID. The main form has this code for the Double-Click event...
Private Sub EmployeeID_DblClick(cancel As Integer)
Dim myID As Variant
myID = Me.EmployeeID
DoCmd.OpenForm "subformEmployeeInfo",,,,,,myID
DoCmd.OpenForm "frm_EmployeeInformation",,,,,,myID
End Sub
When I step through the code I notice that my ID is there on the OpenForm Command but when it switches to the subform code I get an "Invalid Use of Null" error.
With a subform, you can refer to the Parent OpenArgs,:
ID= Me.Parent.OpenArgs
These are the OpenArgs of the form on which the subform resides.