Hi everyone, Newbie alert!!!
Can anyone suggest what is wrong with my code please?
I have this code in a button on my Patient Form:
And this in my Admissions form LoadEvent:
RESULT = Run-time error '2467'
The expression you entered refers to an object that is closed or doesn't exist
Borrowed code from: http://www.datawright.com.au/access_resources/access_docmd.openform_arguments.htm
Can anyone suggest what is wrong with my code please?
I have this code in a button on my Patient Form:
Code:
DoCmd.OpenForm "frm_Admissions", acNormal, , , acFormAdd, , "NHS Number|" & Me.[NHS Number]
And this in my Admissions form LoadEvent:
Code:
Private Sub Form_Load()
'Use this version if the ID is a number
Dim x As Variant
Dim strControl As String
Dim lngID As Long
'If parameters exist, use them
If Len(Me.OpenArgs) > 0 Then
'Split creates a zero-based array from the input string
x = Split(Me.OpenArgs, "|")
strControl = x(0)
lngID = x(1)
Me(strControl) = lngID
End If
End Sub
RESULT = Run-time error '2467'
The expression you entered refers to an object that is closed or doesn't exist
Borrowed code from: http://www.datawright.com.au/access_resources/access_docmd.openform_arguments.htm