G
Guest
I am trying set up data validation routines.
This specfic one involves deposits and amounts if there is ck number then i
want to enforce entering an amount. The macro for this is:
'------------------------------------------------------------
' mcrForceDeposit
'
'------------------------------------------------------------
Function mcrForceDeposit()
On Error GoTo mcrForceDeposit_Err
With CodeContextObject
If ((.Deposit Like "*CK*")) Then
DoCmd.GoToControl "depositAmount"
End If
If (.DepositAmount = 0) Then
Beep
MsgBox "Please enter deposit amount.", vbInformation, "There is
an error here."
End If
End With
mcrForceDeposit_Exit:
Exit Function
mcrForceDeposit_Err:
MsgBox Error$
Resume mcrForceDeposit_Exit
End Function
_________
The cursor does NOT go to the deposit field. The msg box pops but the cursor
stays wherever the user clicked.
I want to prevent that, to force a value in this field >0 or cancel the edit.
This specfic one involves deposits and amounts if there is ck number then i
want to enforce entering an amount. The macro for this is:
'------------------------------------------------------------
' mcrForceDeposit
'
'------------------------------------------------------------
Function mcrForceDeposit()
On Error GoTo mcrForceDeposit_Err
With CodeContextObject
If ((.Deposit Like "*CK*")) Then
DoCmd.GoToControl "depositAmount"
End If
If (.DepositAmount = 0) Then
Beep
MsgBox "Please enter deposit amount.", vbInformation, "There is
an error here."
End If
End With
mcrForceDeposit_Exit:
Exit Function
mcrForceDeposit_Err:
MsgBox Error$
Resume mcrForceDeposit_Exit
End Function
_________
The cursor does NOT go to the deposit field. The msg box pops but the cursor
stays wherever the user clicked.
I want to prevent that, to force a value in this field >0 or cancel the edit.