Question Locked

Up and Down Arrow Keys in a MS Access 2003 Subform

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am using an Access form with a subform for data entry. The subform is like a grid and the end users would like to be able to move up and down between rows in the grid staying in a specific field using the arrow keys. The arrow keys let you move from field to field within the record but not up and down between records/rows. The subform is linked to a different table than the main form.

Is there a relatively simple way to do this?

2 replies

by kathyw

1. First you have to set the KeyPreview property of your subform to 'Yes'

2. Now set the OnKeyDown event of your subform to Event procedure

3. The following code will work for arrow keys (including Shift Number on the num keypad)

Select Case KeyCode
Case 38 'Up Arrow
If Not Me.Recordset.BOF Then
Me.Recordset.MovePrevious
End If
Case 40 'Down Arrow
If Not Me.Recordset.EOF Then
Me.Recordset.MoveNext
End If
End Select

This discussion is closed to new replies.