Hello,
I have the datasheet form that form show up data by each orderID.
In the this form I have a payment percentage field. I want to restrict this percentage when the user enter "percentage". The logical is total percentage should be less than 1.
e.g: the user enter first row percentage is: 60%
the user enter second row percentage is: 20%
the user enter third row percentage is: 30% (Should get error here) Can somebody help me out? How?
The following are my codes but doesn't work:
private txtPercent_AfterUpdate()
Dim dblPercent as Double
tmp = dblPercent + txtPercent
If tmp > 1 then
msgbox "The total percentage should be less than 1"
Exit sub
End if
dblPercent = tmp
End Sub
Thanks.
Wdu
I have the datasheet form that form show up data by each orderID.
In the this form I have a payment percentage field. I want to restrict this percentage when the user enter "percentage". The logical is total percentage should be less than 1.
e.g: the user enter first row percentage is: 60%
the user enter second row percentage is: 20%
the user enter third row percentage is: 30% (Should get error here) Can somebody help me out? How?
The following are my codes but doesn't work:
private txtPercent_AfterUpdate()
Dim dblPercent as Double
tmp = dblPercent + txtPercent
If tmp > 1 then
msgbox "The total percentage should be less than 1"
Exit sub
End if
dblPercent = tmp
End Sub
Thanks.
Wdu