Hitting Enter Twice in the Find and Replace Dialogue Box

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
 
G

Guest

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

Intui_Sol

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

Guest

If you use the method I suggested, you will not use that code.
Sendkeys should be avoided.
 
I

Intui_Sol

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

benyod79 via AccessMonster.com

Don't use sendkeys. Yuck.

Try using RunCommand acCmdFind

Or use the previous poster's suggestion (which is generally the method used).
 
G

Guest

FYI, Microsoft says the RunCommad is obsolete and should no longer be used.
It is only available to support backwards compatiblity.
 

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