Forum Discussion
hohai610
Feb 15, 2021Copper Contributor
How i can set up a keystroke for an action MS ACCESS
HELLO EVERYONE ,PLEASE HELP ME ON THIS
I HAVE A TEXT BOX IN A FORM. I WOULD LIKE TO ADD AND DELETE QUANTITY INSIDE THE SUBFORM BY THAT TEXT BOX.
THIS IS WHAT I WANNA DO.
ADD :I WILL INPUT A NUMBER FOR QTY AND PRESS "+" (RIGHT KEYPAD) .
DELETE : I WILL INPUT A NUMBER FOR QTY AND PRESS " - "
WHICH CODE I CAN USE TO ASSIGN THE ACTION FOR THE "+" AND "-" .
THANKS ,EDWARD
- Could you not use the key press event?
https://docs.microsoft.com/en-us/office/vba/api/Access.Form.KeyPress- hohai610Copper Contributor
hi ,thank you for reply
Can you show me a easy example for keypress event please ?- George_HepworthSilver Contributor
Here's an easy example. Create a procedure like this:
Public Sub CaptureKeyPress(ByVal KeyANSI As String)
MsgBox KeyANSI
End SubUse it like this:
Private Sub TextYourControlNameGoesHere_KeyDown(KeyCode As Integer, Shift As Integer)
Call CaptureKeyPress(KeyCode)
End Sub