I use the following:
(you also have to set the forms key-preview to yes in the events tab.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
' key hand
Select Case KeyCode
' Case vbKeyEscape
' KeyCode = 0
' DoCmd.Close
Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acPrevious
Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acNext
' Case vbKeyReturn
' If IsNull(Me.ID) = False Then
' KeyCode = 0
' Call EditMain
' End If
End Select
End Sub
I also usually make the Enter key open up a form to view/edit the details.
You can see the above code, but I have it commented out. The same goes for
the Esc key example above hat exits the form. You can actually remove the
extra code above, as all you need to enable the arrow keys is:
Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acPrevious
Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acNext