Hitting Enter Twice in the Find and Replace Dialogue Box

  • Thread starter Thread starter Intui_Sol
  • Start date Start date
I

Intui_Sol

in a single form in ms access, i have a combo box with a row source
type of "table/query". I have a command button that users hit to find
part numbers. the code behind the button is:
[Part Number].SetFocus
sendKeys "^f"
The find and replace dialogue box comes up. the user has to enter the
part number twice before it searches the control. Any ideas?
Docmd.findrecord hasn't been working for me
 
Assuming your combo is a list of part numbers and you want to make the
selected part number's record the current record, the normal way to do that
is with the combo's after update event:

Private Sub cboPartNo_AfterUpdate()

With Me.RecordsetClone
.FindFirst "[PART NUMBER] = '" & Me.cboPartNo & "'"
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub
 
I'm trying to have the user avoid hitting Ctrl+F. To no success, the
user still has hit the enter twice after they enter a part number. It
seems like the control is not getting the focus the first time.
 
If you use the method I suggested, you will not use that code.
Sendkeys should be avoided.
 
Sorry, I had an event happening after the part number had lost focus.
Stupid way to set it up- sorry and thanks for the help.
 
Don't use sendkeys. Yuck.

Try using RunCommand acCmdFind

Or use the previous poster's suggestion (which is generally the method used).
 
FYI, Microsoft says the RunCommad is obsolete and should no longer be used.
It is only available to support backwards compatiblity.
 
Back
Top