Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

testing whether the "down arrow" or "up arrow" is pressed on 1

Status
Not open for further replies.

griet

Programmer
Sep 8, 2001
21
BE
I want to detect whether the down arrow is pressed or not in a field on a form in Access 2000.
Can I do something with the ascii-code, and what is the ascii-code for the down arrow ?
Do I have to use the keypress event ?
 
use the KeyDown Event for the textbox, ensure you set the Form's KeyPreview Event to Yes. This Code will get you started

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 38 Then
MsgBox "UpArrow"
ElseIf KeyCode = 40 Then
MsgBox "DownArrow"
Else
MsgBox "Other Key"
End If
End Sub

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top