Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching for records

Status
Not open for further replies.

eussias

Programmer
Sep 25, 2001
97
AU
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!! :cool:

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(&quot;DOB&quot;) <> MyValue Then
MsgBox &quot;No record for that patient!
txtDate.Text = &quot; &quot;
txtDate.SetFocus
Exit Sub
End If
Me.RecordsetClone.FindFirst &quot;[DOB] = #&quot; & MyValue & &quot;#&quot;
Me.Bookmark = Me.RecordsetClone.Bookmark
 
I've done some investigating and it seems that if there is 2 patients with the same DOB it won't navigate to either, and also if there are patients born in the same month of a certain year, it won't navigate either... Anyone help??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top