The IsNavigationKey Function

Public Function IsNavigationKey( _
    intKeyCode As Integer, _
    intShift As Integer _
    ) As Boolean

    'Copyright (c) Brendan Reynolds/Timarco Ltd, 1999.
    'All rights reserved.
    
    'e-mail [email protected]
    
    'This function returns True if the user pressed a
    'navigation key (a key or key-combination that will
    'move the form to another record). Otherwise the
    'function returns False.
    
    'Arguments
    
    'intKeyCode: The KeyCode argument of the Key Down event.
    
    'intShift: The Shift argument of the Key Down event.
    
    'Use (from the Key Down event)
    
    'blnIsNavKey = IsNavigationKey(KeyCode, Shift)
        
On Error GoTo Err_Routine

    Dim lngErrNum As Long
    
    Select Case intKeyCode
    Case vbKeyHome, vbKeyEnd
        If intKeyCode And acCtrlMask Then
            IsNavigationKey = True
        Else
            IsNavigationKey = False
        End If
    Case vbKeyPageUp, vbKeyPageDown
        IsNavigationKey = True
    Case Else
        IsNavigationKey = False
    End Select
    
Exit_Routine:
    Exit Function
    
Err_Routine:
    lngErrNum = Err.Number
    Select Case Err
        '
    Case Else
        Err.Raise lngErrNum
        Resume Exit_Routine
    End Select
    
End Function

Download this function in plain text format, ready for import into your own Microsoft Access 97 or Microsoft Access 2000 application, here.

home