Hi,
I changed my code to the following:
Private Sub cmdFind_Click()
Dim dbs As Database, rstPatient As Recordset
Dim txtBilling_No, strQuote As String
strQuote = Chr$(34)
On Error GoTo ErrorHandler
Set dbs = CurrentDb
Set rstPatient = dbs.OpenRecordset("tblPatient", dbOpenDynaset, dbSeeChanges)
txtBilling_No = Trim(InputBox("Please Enter Billing Number", "Patient Find"))
If IsNull(txtBilling_No) Then
MsgBox ("No Billing Number Entered - Please Enter a Valid Number")
Else
rstPatient.FindFirst "[MEDICARE] = " & strQuote & txtBilling_No & strQuote
If Not (rstPatient.NoMatch) Then
MsgBox ("Patient Number " & str(rstPatient!apkPATIENT))
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
The correct record is found as the rstPatient!apkPatient is correct. The
rstPatient.Bookmark is a "?". Why would the bookmark not be valid?
Thanks,
"Linq Adams via AccessMonster.com" wrote:
> The form doesn't display the found record, I suspect, because no record is
> found!
> I believe this syntax is incorrect
>
> rstPatient.FindFirst "[MEDICARE] = "" txtBilling_No """
>
> If txtBilling_No is defined as Text it should be:
>
> rstPatient.FindFirst "[MEDICARE] = '" & Me.txtBilling_No & "'"
>
>
> If txtBilling_No is defined as Numeric:
>
> rstPatient.FindFirst "[MEDICARE] = " & Me.txtBilling_No
>
> --
> There's ALWAYS more than one way to skin a cat!
>
> Answers/posts based on Access 2000/2003
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...oding/201005/1
>
> .
>