J
J
I have 4 text boxes on a form and I am trying to add their values together
and make sure they aren't greater than 1 before updating the record.
All the fields on the form are identical. They are set up with format
"Percent" and 0 decimal places.
The table setup is the same way.
The weird thing is that I can have the following and it works fine:
ctl1 = .60
ctl2 = .10
ctl3 = .30
ctl4 = 0
or
ctl1 = .95
ctl2 = 0
ctl3 = 0
ctl4 = .05
but if I enter
ctl1 = .60
clt2 = .30
ctl3 = .10
ctl4 = 0
It doesn't think that totals 1. Here is an example of the code:
dim ctl1 as control, ctl2 as control, ctl3 as control, ctl4 as control
ctl1 = forms!F_main!ctl1
ctl2 = forms!f_main!ctl2
ctl3 = forms!f_main!ctl3
ctl4 = forms!f_main!ctl4
if clt1+ctl2+ctl3+ctl4 <>1 then
msgbox "Total does not equal 1"
else
'continue on
end if
Any ideas?
and make sure they aren't greater than 1 before updating the record.
All the fields on the form are identical. They are set up with format
"Percent" and 0 decimal places.
The table setup is the same way.
The weird thing is that I can have the following and it works fine:
ctl1 = .60
ctl2 = .10
ctl3 = .30
ctl4 = 0
or
ctl1 = .95
ctl2 = 0
ctl3 = 0
ctl4 = .05
but if I enter
ctl1 = .60
clt2 = .30
ctl3 = .10
ctl4 = 0
It doesn't think that totals 1. Here is an example of the code:
dim ctl1 as control, ctl2 as control, ctl3 as control, ctl4 as control
ctl1 = forms!F_main!ctl1
ctl2 = forms!f_main!ctl2
ctl3 = forms!f_main!ctl3
ctl4 = forms!f_main!ctl4
if clt1+ctl2+ctl3+ctl4 <>1 then
msgbox "Total does not equal 1"
else
'continue on
end if
Any ideas?