Private Sub NetAmount_AfterUpdate() On Error GoTo NetAmount_AfterUpdate_Error Dim nAmt As Long Dim nAmtTotal As Long nAmt = Format(Me.NetAmount, "Currency") nAmtTotal = FormatCurrency(Forms![frmCodingSlip]![txtMCFRemainingUS].value, 2) If nAmt > nAmtTotal Then Select Case _ MsgBox("The system is unable to process the current invoice due to the Remaining Funds of " _ & nAmtTotal & " is less than the amount of entered." _ & vbCrLf & "" _ & vbCrLf & "Please validate and adjust the amount enter that is no greater than the Remaining Funds." _ , vbOK Or vbCritical Or vbDefaultButton1, "Funds Discrepancy") Case vbOK Me.NetAmount = vbNullString Exit Sub End Select Else Me.Currency.SetFocus Me.Currency.Dropdown End If On Error GoTo 0 Exit Sub NetAmount_AfterUpdate_Error: MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure NetAmount_AfterUpdate of VBA Document Form_frmInvoiceSub" End Sub
From novice to tech pro — start learning today.