The code below is working fine for the majority of the records, but for some reason, every known and then, will not find a specific date that is already in the database. It is used to search for a patient with a specific date of birth. Does anyone know why this may be happening?
Dim rst As Recordset
Dim myBookmark As Date
txtDate.SetFocus
If txtDate.Text = "" Then
MsgBox "You must enter a Date of Birth"
Exit Sub
End If
Set rst = CurrentDb.OpenRecordset("SELECT * FROM ClientInfo WHERE [DOB] = #" & txtDate.Text & "#"
On Error Resume Next
Dim MyValue As Date
MyValue = txtDate
rst.MoveFirst
If rst.Fields("DOB" <> MyValue Then
MsgBox "No record for that patient", vbInformation, "LMTC Database"
txtDate.Text = " "
txtDate.SetFocus
Exit Sub
End If
Me.RecordsetClone.FindFirst "[DOB] = #" & MyValue & "#"
Me.Bookmark = Me.RecordsetClone.Bookmark
Dim rst As Recordset
Dim myBookmark As Date
txtDate.SetFocus
If txtDate.Text = "" Then
MsgBox "You must enter a Date of Birth"
Exit Sub
End If
Set rst = CurrentDb.OpenRecordset("SELECT * FROM ClientInfo WHERE [DOB] = #" & txtDate.Text & "#"
On Error Resume Next
Dim MyValue As Date
MyValue = txtDate
rst.MoveFirst
If rst.Fields("DOB" <> MyValue Then
MsgBox "No record for that patient", vbInformation, "LMTC Database"
txtDate.Text = " "
txtDate.SetFocus
Exit Sub
End If
Me.RecordsetClone.FindFirst "[DOB] = #" & MyValue & "#"
Me.Bookmark = Me.RecordsetClone.Bookmark