Help with the "On Key Press" function

speedracer1971

New member
Local time
Today, 02:39
Joined
Nov 20, 2004
Messages
6
I am trying to get an action to take place when the "enter" key is pressed. The code I have does not recognize the "enter" key. When I put in the "a" key the code works. Can someone please look at the code below and tell me what I need to put in place of "a" to get the code to work with "enter" key??? I have tried ("CR", "013", "enter").

Private Sub PickupBy_KeyPress(KeyAscii As Integer)
If KeyAscii <> Asc("a") Then GoTo Exit_PickupBy_KeyPress

On Error GoTo Err_PickupBy_KeyPress

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "By_Dealer_Standby_Results"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_PickupBy_KeyPress:
Exit Sub

Err_PickupBy_KeyPress:
MsgBox Err.Description
Resume Exit_PickupBy_KeyPress
End Sub
 
How about:

If KeyAscii = 13 Then

or just "13".
 
Last edited:

Users who are viewing this thread

Back
Top Bottom