Function fPlusMinus(KeyAscii As Integer, _ Optional dblAmt As Double = 1) '******************************************************************** ' Name: fPlusMinus ' Purpose: Increment or decrement a textbox using the + and - keys ' ' Inputs: KeyAscii As Integer ' dblAmt As Double ' ' Author: Arvin Meyer ' Date: August 18, 2002 ' Comment: Can be used for dates or any numbers as long as ' the correct datatype is used ' ' 1 minute = 6.94444444444444E-04 ' 5 minutes = 3.47222222222222E-03 ' 15 minutes = 1.04166666666667E-02 ' 1 day = 1 ' Usage: ' Set form control's KeyPress event to: [Event Procedure] ' n is the number to increment ' 1 is the default, if unused, leave comma out: ' Call fPlusMinus(KeyAscii) ' Sample Code: ' Sub txtYourControl_KeyPress(KeyAscii As Integer) ' Call fPlusMinus(KeyAscii, n) ' End Sub ' '******************************************************************** On Error GoTo ErrHandler Select Case KeyAscii Case Asc("-"), Asc("_") Screen.ActiveControl = Screen.ActiveControl - dblAmt KeyAscii = 0 Case Asc("="), Asc("+") Screen.ActiveControl = Screen.ActiveControl + dblAmt KeyAscii = 0 End Select ExitHere: Exit Function ErrHandler: Select Case Err Case Else MsgBox Err.Number & ": " & Err.Description End Select End Function