acCmdFindNext Settings

  • Thread starter Thread starter w3wn
  • Start date Start date
W

w3wn

Guest
I'm trying to add a control button on the main form of my database so that the users can do a lookup of customers by their last names.

I would like it to have the same functionality as the Find & Replace button on the toolbar. Specifically, I want to make sure that the lookup is done only on the LastName field in the database.

Of course, nothing is as easy as it should be. My coding brings up the F&R window, but the "Look In" field is grayed out and defaulted to the entire form, not the "Last Name" field.

There has to be some way to set this... but so far, no such luck finding it.

My code is the default:
--------------------------------------
Private Sub FindCustomer_Click()
Screen.PreviousControl.SetFocus
DoCmd.RunCommand acCmdFind

Exit_FindCustomer_Click:
Exit Sub

End Sub
--------------------------------------

I've also tried it with a suggested SendKeys setting:

--------------------------------------
Private Sub FindCustomer_Click()
Screen.PreviousControl.SetFocus
SendKeys "%ha%n%e", False
DoCmd.RunCommand acCmdFind

Exit_FindCustomer_Click:
Exit Sub

End Sub
--------------------------------------

So what am I missing here? (Days like this, I miss dBase!)

Thanks!

Ron Notarius, IT Support
All-Clad Metalcrafters LLC
Canonsburg, PA
rnotarius@allclad.com
 
Well I had no problem moding your code to work.
Interesting way of using a serch form as well mate.

So I made a button and I set the field([strSomeText]) on the form that I wanted to serch.

Code:
Me.strSomeText.SetFocus
DoCmd.RunCommand acCmdFind

And it worked fine.
Let us know how you get on.
 

Users who are viewing this thread

Back
Top Bottom