Access MVP (2010-2015)

oOo.oOo.oOo.oOo.oOo.oOo

Navigate a Continuous Form like Excel…

Continuous forms allow you to display data resembling an Excel spreadsheet.  However, you can’t navigate a Continuous form like you do an Excel spreadsheet (much to your Users dismay), well, that is, not until now…

In your modUtilities copy/paste the below (If you don’t have a modUtilities create one.  It’s a place to keep all your resusable code!)

Sub NavigateRecords(KeyCode As Integer)
On Error GoTo Err_handle

   Select Case KeyCode
     Case 38 '--Up Arrow--
       DoCmd.GoToRecord , , acPrevious
     Case 40 '--Down Arrow--
       DoCmd.GoToRecord , , acNext
   End Select
Exit Sub

Err_handle:
Beep

End Sub

In Design Mode of the Continuous form, on the KeyDown event of *each* control put Call NavigateRecords(KeyCode), see example below…

Private Sub cboActionID_KeyDown(KeyCode As Integer, Shift As Integer)
Call NavigateRecords(KeyCode)
End Sub

Go to Form View and now you can use the Arrow Keys on your keyboard to navigate your Form.

540 total views, 1 views today

Comments are closed.