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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Record Code Not Working 1

Status
Not open for further replies.

OzzieTheOwl

Technical User
Jun 26, 2006
61
GB
Hi

I have the following code, which is supposed to find and navigate to a record on a form, from an entry made in a textbox in the form. The field searched could either be a number or text entry, so I have made the field a text field.
I am using Access 97 if that makes any difference.

Code:
Private Sub cmdFind_Click()
    Dim rs As Object
    Set rs = Me.RecordsetClone
    rs.FindFirst "[Invoice_Number] = " & Str(Me![txtFindInvoice])
    Me.Bookmark = rs.Bookmark
End Sub

When the code runs I am getting the following error message.

Run-time error 3464
Data type mismatch in criteria expression

When I hit Debug the following line is highlighted

rs.FindFirst "[Invoice_Number] = " & Str(Me![txtFindInvoice])

Am I missing something?

Thanks in advance for your help

Barney
 
rs.FindFirst "[Invoice_Number] = [!]'[/!]" & Me![txtFindInvoice] [!][tt]& "'"[/tt][/!]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV

Once again you have come up with the goods.
Have another star on me

Thanks once again.

Barney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top