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

find record command "error 2162"

Status
Not open for further replies.

davikokar

Technical User
May 13, 2004
523
IT
Hallo I have a single form. I would like to put an unbound text field to use it as a search text box for the whole recordset. The user write something and then click a small "go" button. The code I put behind the button is this:

DoCmd.FindRecord [Txt_search], acAnywhere

but there is this runtime error 2162: a macro set to one of the current fields properties failed because of an error in a findrecord action argument.

Does someone know what's going on?
thanks
 
karerda,

Try:

DoCmdFindRecord Me![Txt_search], acAnywhere.

HTH
Todd
 
Hallo Tcarpenter,
I tried:
Me!txt_search
Me.txt_search
Me![txt_search]
but none works...
 
karerda,

Sorry, I'm afraid I don't use FindRecord enough to know the ins and outs, but I suspect your problem may have something to do with this blurb I found in the help file:

However, note that if you use a command button to run a macro containing the FindRecord action, the first instance of the search criteria will be found repeatedly. This is because clicking the command button changes the focus from the field containing the matching value. The FindRecord action will then begin searching from the start of the record. The first instance of the search criteria will be found repeatedly in the same record. To avoid this problem, run the macro by using a technique that doesn't change the focus, such as a custom toolbar button or a key combination defined in an AutoKeys macro, or in the macro set the focus to the field containing the search criteria before you carry out the FindRecord action.

HTH
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top