I’ve been using the code below in Access 97 for years now without any
problems at all. Unfortunately, I now have to convert this db to Access
2000. I tried using the conversion feature and that was a bust. All my
reports, queries and other forms work OK except for this routine. The first
hang-up begins with the “dbOpenSanpshot” – does this exist in 2000?
Also when I type “rstPatient” the “FindFirst” isn’t a method available to me
nor is "NoMatch. What’s the alternative?
Thanks tons,
Becky
Private Sub txtMRN_BeforeUpdate(Cancel As Integer)
'**Looks for duplicate MRN's
Dim rstPatient As Recordset
Dim strMessage As String
strMessage = "THIS MRN IS ALREADY IN THE DATABASE."
strMessage = strMessage & vbCrLf & vbCrLf & "Click OK then click ..."
strMessage = strMessage & vbCrLf & vbCrLf & "Accept to accept the MRN or
Cancel to enter a new MRN."
Set rstPatient = CurrentDb.OpenRecordset("tblShared_Patients",
dbOpenSnapshot)
rstPatient.FindFirst "MRN = '" & txtMRN & "'"
If Not rstPatient.NoMatch Then
MsgBox strMessage, vbInformation
strTargetMRN = txtMRN
With cmdAccept '**allow user to accept MRN
.Enabled = True
.Default = True
End With
cmdCancel.Enabled = True
Cancel = True
SendKeys "{Esc 3}", False
End If
rstPatient.Close
Set rstPatient = Nothing
End Sub