mahmed1
Well-known Member
- Joined
- Mar 28, 2009
- Messages
- 2,266
- Office Version
- 365
- 2016
- Platform
- Windows
Hi All,
I have written this afterUpdate event
For some reason when i set the txtBal.setfocus it starts that event again but i thought the enable event would have cancell the event while it resets the focus
Thank You
Here is the code
I have written this afterUpdate event
For some reason when i set the txtBal.setfocus it starts that event again but i thought the enable event would have cancell the event while it resets the focus
Thank You
Here is the code
Code:
Private Sub txtAmt_AfterUpdate()
txtAmt = Format(txtAmt, "£#,##0.00")
If txtBal.Value = "" Or txtAmt.Value = "" Then
MsgBox "Both Balance and Amount fields need to be filled in to proceed further", vbOKOnly, "Update All Fields"
Exit Sub
ElseIf txtBal.Value < txtAmt.Value Then
MsgBox "Balance has to be greater than Amount", vbOKOnly, "INVALID INPUT"
txtBal.Value = ""
txtAmt.Value = ""
Application.EnableEvents = False
txtBal.SetFocus
Application.EnableEvents = True
Exit Sub
Else
txtNoPmt = txtBal.Value / txtAmt.Value
End If
End Sub