arrow keys

maxmangion

AWF VIP
Local time
Today, 16:59
Joined
Feb 26, 2003
Messages
2,805
i have a form in Tabular format, and when i press the down arrow key, it will move to the next field in the same row.

How can i set it, so that when i press the down arrow key, it will move to the next record field rather than the next available field in the same record.

Thx!
 
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
 
in which part shall i put that code ?

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

On the Forms Key_Down event.

You also need to set on the forms load event

Me.KeyPreview = True

Dave
 
Not sure which version of access Rich is using

A2000

DoCmd.GoToRecord , , acNext

DoCmd.GoToRecord , , acPrevious

Dave
 

Users who are viewing this thread

Back
Top Bottom