Hi All,
have a form frm_Inpatients with a command button that loads another form frm_PatientInfoSummary. I am trying to pass the primary key (or some other identifiable variable) from one form to another so that it load's the right info in the other form.
My Globals are declared in a seperate module:
glbPatientID as String
The code in the base form frm_Inpatients is
On the other side I have a form who's on Open property recieves the glbPatientID
However this throws an error "cannot assign a value to this object"
I have the same set up which works for another form which opens from the same base form "frm_Inpatients" which works without issue:
and the code on the "frm_Operation"
Can anyone shed light on what's going wrong?
have a form frm_Inpatients with a command button that loads another form frm_PatientInfoSummary. I am trying to pass the primary key (or some other identifiable variable) from one form to another so that it load's the right info in the other form.
My Globals are declared in a seperate module:
glbPatientID as String
The code in the base form frm_Inpatients is
Code:
Private Sub InfoSummary_Click()
Dim patID As Long
patID = Me.intPatientID
glbPatientID = patID
DoCmd.OpenForm "frm_PatientInfoSummary", , , , , acDialog
End Sub
On the other side I have a form who's on Open property recieves the glbPatientID
Code:
Private Sub Form_Open(Cancel As Integer)
Me.intPatientID = glbPatientID
End Sub
However this throws an error "cannot assign a value to this object"
I have the same set up which works for another form which opens from the same base form "frm_Inpatients" which works without issue:
Code:
Private Sub BookOperation_Click()
'Opens Booking form in for this patient
On Error GoTo Err_hand
Dim vid As Long
Dim verror As Boolean
Dim crit As String
On Error GoTo err_verror
vid = Me.intPatientID
If verror = True Then
verror = False
MsgBox "No Record Selected", vbCritical
GoTo progout
End If
glbPatientID = vid
glbOperation_ADDNEW = True
DoCmd.OpenForm "frm_Operation", , , , , acDialog
glbOperation_ADDNEW = False
progout:
Exit Sub
err_verror:
verror = True
Resume Next
Err_hand:
MsgBox Err.Description
Resume progout
End Sub
and the code on the "frm_Operation"
Code:
Private Sub Form_Open(Cancel As Integer)
If glbOperation_ADDNEW = True Then
DoCmd.GoToRecord , , acNewRec
Me.intPatientID = glbPatientID
End If
glbOperation_ADDNEW = False
End Sub
Can anyone shed light on what's going wrong?