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
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