From: CharlesD on
Hi,

I changed the rstPatient recordset to a clone of the form with
Set rstPatient = Me.RecordsetClone and all works well.

Thanks for the help.

Regards,

CharlesD

"CharlesD" wrote:

> Hi,
>
> I have a form that is bound to a table (tblPatient). I have tried using
> CRTL F as the method of searching the table. It does not work well moving
> off the search field after a find and other issues. I have tried adding the
> following code to allow a search on the MEDICARE field in the table, but the
> form does not display the found record. I would appreciate any help to
> understand how to search and dsipaly a found record. Below is my code.
>
> Thanks,
>
> Private Sub cmdFind_Click()
> Dim dbs As Database, rstPatient As Recordset
> Dim txtBilling_No As String
>
> On Error GoTo ErrorHandler
>
>
> Set dbs = CurrentDb
> Set rstPatient = dbs.OpenRecordset("tblPatient", dbOpenDynaset, dbSeeChanges)
>
> txtBilling_No = InputBox("Please Enter Billing Number", "Patient Find")
> If IsNull(txtBilling_No) Then
> MsgBox ("No Billing Number Entered - Please Enter a Valid Number")
> Else
> ' MsgBox ("Patient Number " & txtBilling_No)
> rstPatient.FindFirst "[MEDICARE] = ""txtBilling_No"" "
> If Not (rstPatient.BOF And rstPatient.EOF) Then
> Me.Bookmark = rstPatient.Bookmark
> Me.Refresh
> Else
> MsgBox ("Patient Not Found - Please Enter a New Number")
> End If
> End If
>
> GoTo Exit_cmdFind_Click
>
> ErrorHandler:
> MsgBox LTrim(RTrim(Me.NAME)) + "." + "Patient Find - " + "Error: " +
> AccessError(Err.Number)
>
> Exit_cmdFind_Click:
> rstPatient.Close
> Set dbs = Nothing
> Set rstPatient = Nothing
> End Sub
>
>