My form (frmERLogs) for this project (ER Log Book) has a combo box (cboMedicalReco rdNumber) that I want to be able to double click on to bring up a new form (frmPatientInfo rmation) when a name is not already in the list. When I double click on that combo box, I get this message 'Compile error - Invalid qualifier'. Below is the coding for the double click event:
[code=vb]Private Sub cboMedicalRecor dNumber_DblClic k(Cancel As Integer)
Dim rs As DAO.Recordset
Dim strWhere As String
Const frmPatientInfor mation = "Patients"
'Set up to search for the current customer.
If Not IsNull(Me.cboMe dicalRecordNumb er) Then
strWhere = "cboMedicalReco rdNumber = """ & Me.cboMedicalRe cordNumber & """"
End If
'Open the editing form.
If Not frmPatientInfor mation.AllForms (frmPatientInfo rmation).IsLoad ed Then 'above statement emboldened before code tags added
DoCmd.OpenForm frmPatientInfor maion
End If
With Forms(frmPatien tInformation)
'Save any edits in progress, and make it the active form.
If .Dirty Then .Dirty = False
.SetFocus
If strWhere <> vbNullString Then
'Find the record matching the combo.
Set rs = .RecordsetClone
rs.FindFirst strWhere
If Not rs.NoMatch Then
.Bookmark = rs.Bookmark
End If
Else
'Combo was blank, so go to new record.
RunCommand acCmdRecordsGoT oNew
End If
End With
Set rs = Nothing
End Sub[/code]
The sentence in bold is the part that shows as being a problem. The part 'frmPatientInfo rmation' in front of AllForms(frmPat ientInformation ) is highlighted. Is it supposed to be the project name in front of 'AllForms(frmPa tientInformatio n)? And if so, how is it coded. Nothing I have tried putting in there has changed the error that comes up.
I am working in Access 2003
Thanks for any help you can provide.
[code=vb]Private Sub cboMedicalRecor dNumber_DblClic k(Cancel As Integer)
Dim rs As DAO.Recordset
Dim strWhere As String
Const frmPatientInfor mation = "Patients"
'Set up to search for the current customer.
If Not IsNull(Me.cboMe dicalRecordNumb er) Then
strWhere = "cboMedicalReco rdNumber = """ & Me.cboMedicalRe cordNumber & """"
End If
'Open the editing form.
If Not frmPatientInfor mation.AllForms (frmPatientInfo rmation).IsLoad ed Then 'above statement emboldened before code tags added
DoCmd.OpenForm frmPatientInfor maion
End If
With Forms(frmPatien tInformation)
'Save any edits in progress, and make it the active form.
If .Dirty Then .Dirty = False
.SetFocus
If strWhere <> vbNullString Then
'Find the record matching the combo.
Set rs = .RecordsetClone
rs.FindFirst strWhere
If Not rs.NoMatch Then
.Bookmark = rs.Bookmark
End If
Else
'Combo was blank, so go to new record.
RunCommand acCmdRecordsGoT oNew
End If
End With
Set rs = Nothing
End Sub[/code]
The sentence in bold is the part that shows as being a problem. The part 'frmPatientInfo rmation' in front of AllForms(frmPat ientInformation ) is highlighted. Is it supposed to be the project name in front of 'AllForms(frmPa tientInformatio n)? And if so, how is it coded. Nothing I have tried putting in there has changed the error that comes up.
I am working in Access 2003
Thanks for any help you can provide.
Comment