Execute Search With The Enter Key(instead Of Mouse Click)

Ronaldo9

Registered User.
Local time
Today, 01:34
Joined
Jul 20, 2011
Messages
21
I have a Search form where users can go and perform queries(single or multiple). They click the Search button to view the result.

Between the eight different fields they can search on, the first field(Log no.) is the most used one. I'm trying to make it easier for them, by allowing them to enter the Log number and hit the Enter key to perform the Search, instead of reaching for the mouse and clicking the search button, since this search is heavily used.

I tried the following method(among others), but I'm not having any luck.

(this is on the KeyPress event of the Log number text field on the search form)

Private Sub txtFilterLogNum_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then 'ascii no for Enter key
Call SearchLogNo_Click 'the function that executes when the search button is clicked
End If
End Sub

Would anybody have any idea how to go about this ???
I Would really appreciate it.

Many Thanks,
Elias
 
Access allows one Command Button on a given Form to be triggered by hitting the <Enter> Key.

In Form Design View, select your Command Button and go to Properties - Other and set the Default Property to Yes.

The Command Button code will be executed regardless of where the cursor is on the Form.

Linq ;0)>
 
Great !! that was simple.. didn't know you can do that.
Thank you very much.
E
 

Users who are viewing this thread

Back
Top Bottom