J
John F.
Hi. There must be a simple error here but I just can't see it.
I have a table wih two columns, "Diagnosis" and "DiagnosisCode". The
PrimaryKey is the column "Diagnosis".
I'm trying to get the DiagnosisCode associated with a "Diagnosis" using Seek:
Set db = CurrentDb
Set rs = db.OpenRecordset("tblDiagnosisList", dbOpenTable)
'Set the index -- you have to do this to use Seek method
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Diagnosis1
If rs.NoMatch Then
msgboxResult = MsgBox("Diagnosis not on list. Add it manually.",
vbOKOnly)
Else
'Now return the diagnosis code corresponding to that diagnosis
Me.Diagnosis1Code = rs.DiagnosisCode
End If
I get the error message "Method or data member not found", highlighting
rs.DiagnosisCode. I never get the 'NoMatch' msgBox if I comment out the
rs.DiagnosisCode, so I know the Seek is finding the record but I just can't
see why this doesn't return the rs.DiagnosisCode.
Can anyone spot the error?
Thank you.
johno
I have a table wih two columns, "Diagnosis" and "DiagnosisCode". The
PrimaryKey is the column "Diagnosis".
I'm trying to get the DiagnosisCode associated with a "Diagnosis" using Seek:
Set db = CurrentDb
Set rs = db.OpenRecordset("tblDiagnosisList", dbOpenTable)
'Set the index -- you have to do this to use Seek method
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Diagnosis1
If rs.NoMatch Then
msgboxResult = MsgBox("Diagnosis not on list. Add it manually.",
vbOKOnly)
Else
'Now return the diagnosis code corresponding to that diagnosis
Me.Diagnosis1Code = rs.DiagnosisCode
End If
I get the error message "Method or data member not found", highlighting
rs.DiagnosisCode. I never get the 'NoMatch' msgBox if I comment out the
rs.DiagnosisCode, so I know the Seek is finding the record but I just can't
see why this doesn't return the rs.DiagnosisCode.
Can anyone spot the error?
Thank you.
johno