I have writted the code below to allow the user to use the arrow keys to navigate up and down a report. I also want the functionalily so if the user is at the first record and hits the up arrow key they will go to the bottom and vice versa.

I know I need to write code that knows the record numbers and says if at "1" go to last and if at last go to "1', but I am not certain of the code.

Select Case KeyCode
'Up Arrow


Case 38
If Not Me.Recordset.BOF Then
Me.Recordset.MovePrevious
Else: Me.Recordset.MoveEOF
End If
'Down Arrow
Case 40
If Not Me.Recordset.EOF Then
Me.Recordset.MoveNext
Else: Me.Recordset.MoveBOF
End If
End Select
End Sub