I posted this about a week ago... for some reason the code below isn't finding all the records. It searches the recordset for a specific date of birth, and then navigates to the record. For about 95% of the records it's fine, but there are some that it won't find. Does anyone know why this might be?? Any help would be greatly appreciated!!
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
Debug.Print "DOB Field Value : " & rst.Fields("DOB" & vbCrLf & "MyValue :" & CStr(MyValue)
rst.MoveFirst
If rst.Fields("DOB" <> MyValue Then
MsgBox "No record for that patient!
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
Debug.Print "DOB Field Value : " & rst.Fields("DOB" & vbCrLf & "MyValue :" & CStr(MyValue)
rst.MoveFirst
If rst.Fields("DOB" <> MyValue Then
MsgBox "No record for that patient!
txtDate.Text = " "
txtDate.SetFocus
Exit Sub
End If
Me.RecordsetClone.FindFirst "[DOB] = #" & MyValue & "#"
Me.Bookmark = Me.RecordsetClone.Bookmark