Hi All,
I have a form which records payments for a membership. The form also displays the total amount paid by summing all the payments and the balance owing by subtracting the total paid from 50 (50 -txtTotalPaid).
The AmntPaid field defaults to $50.
I need to check if the AmntPaid is more than balance owing.
I'm already using the BeforeUpdate event which works great if the user is editing an existing record however if the default of $50 is left there obviously no update occurs and the BeforeUpdate event is not triggered.
I have tried using the validation in the field properties which does nothing.
I have tried the lostfocus event however for some reason trying to set focus back to the AmntPaid field is ignored completely and the focus shifts to the next control.
This is the code I'm using on the BeforeUpdate and is what I want to do if the default is left at $50.00.
Anyone have any ideas?
Thanks
I have a form which records payments for a membership. The form also displays the total amount paid by summing all the payments and the balance owing by subtracting the total paid from 50 (50 -txtTotalPaid).
The AmntPaid field defaults to $50.
I need to check if the AmntPaid is more than balance owing.
I'm already using the BeforeUpdate event which works great if the user is editing an existing record however if the default of $50 is left there obviously no update occurs and the BeforeUpdate event is not triggered.
I have tried using the validation in the field properties which does nothing.
I have tried the lostfocus event however for some reason trying to set focus back to the AmntPaid field is ignored completely and the focus shifts to the next control.
This is the code I'm using on the BeforeUpdate and is what I want to do if the default is left at $50.00.
Code:
If Me.mpPayAmnt > Me.txtBalance Then
MsgBox "You can't pay more than is owing.", vbExclamation, "Over Paid"
Cancel = True
'Select all the text in mpPayAmnt
mpPayAmnt.SelStart = 0
mpPayAmnt.SelLength = Len(mpPayAmnt)
Else
Me.Dirty = False
End If
Anyone have any ideas?
Thanks