Using the Down Arrow

  • Thread starter Thread starter CD Tom
  • Start date Start date
C

CD Tom

I would like to use the UP and Down arrow to jump from
one field to another in a form. When you setup a Event
for Key down any key pressed caused the field to move.
How do you identify the key you want to use.
Thanks for your help.
 
CD Tom said:
I would like to use the UP and Down arrow to jump from
one field to another in a form. When you setup a Event
for Key down any key pressed caused the field to move.
How do you identify the key you want to use.
Thanks for your help.


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

On Error GoTo ErrHandler
Select Case KeyCode
Case vbKeyDown
***Your code goes here***
KeyCode = 0
Case vbKeyUp
***Your code goes here***
KeyCode = 0
Case Else
' Do nothing at all!
End Select

End Sub
 
You would automatically get what you want by just setting
the Tools/Options/Keyboard settings to:
Arrow Key Behavior = Next Field
Behavior Entering Field = Select Entire Field
However, if you are in an Option Button Group or Memo
Field, you would still have to use the Enter or Tab key to
leave the group or field.
 
Back
Top