Find Button

  • Thread starter AHizon via AccessMonster.com
  • Start date
A

AHizon via AccessMonster.com

Hello,

I have the following program for a Find Command Button:
Private Sub CmdFind_Click()
On Error GoTo errhandler:
Comments.SetFocus

Answer = InputBox("What are you looking for?", "Find All In The Refund")
If Answer <> "" Then
DoCmd.FindRecord Answer, acAnywhere, NO, acSearchAll, NO, acAll, NO
End If
Exit Sub
errhandler:
Select Case Err.Number
Case 2162
Case 0
Case Else
MsgBox (Err.Number & " " & Err.Description)
End Select

End Sub

I want it to find any record in the table that meets the Answer criteria.
But the button will not work and gives me the following error message:
424 Object Required

I don't want to use the Find button that the Wizard creates because you have
to be in the exact field that you want to search. I'd like the user to be
able to enter data in the Answer input box and search all record that matches
it. I copied the above code from an existing database that works in that
database, but when I copy & pasted this Find button in a new Database it will
not work. Does anyone have any suggestions?

Thanks
Abigail
 
B

boblarson

Instead of using NO use FALSE:

DoCmd.FindRecord Answer, acAnywhere, FALSE, acSearchAll, FALSE, acAll, FALSE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top