using down/up arrow to move between records in form

rklchow

New member
Local time
Today, 06:28
Joined
Dec 13, 2001
Messages
8
I have a few forgin keys in this form, i was wondering if i can use the down/up key to move to next record in the form without it losing focus, like i can keep pressing down to go to next record
thx
 
You can set just about any keystroke to perform just about any action. Look at the help screens for the KeyPress event for the details of how to do it.
 
For those of us who aren't code literate, can someone provide an example of what AlanS is suggesting?

For example, I want to be able to move up and down between controls, like in Excel, rather than having to zip through all fields in one record before moving to the next record.
 
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo Form_KeyDown_Err
Select Case KeyCode
Case vbKeyDown
DoCmd.GoToRecord Record:=acNext
KeyCode = 0
Case vbKeyUp
DoCmd.GoToRecord Record:=acPrevious
KeyCode = 0
Case Else

End Select

Form_KeyDown_Exit:
Exit Sub

Form_KeyDown_Err:
Select Case Err.Number
Case adhcErrInvalidRow
KeyCode = 0
Case Else
MsgBox "Error: " & Err.Description & _
" (" & Err.Number & ")"
End Select
Resume Form_KeyDown_Exit
End Sub
 

Users who are viewing this thread

Back
Top Bottom