form coding on before update

S

scott04

Hi everyone. I have a yes/no field on my form with 3 number fields related
to the the yes/no form. If the the yes/no form is True then i would like at
least one of the three number fields to have a number greater than 0. I have
it set so that if the yes/no is false it automatically sets the three number
fields to 0 but i am trying to set a rule that forces you to enter a number
in one or more of the three fields. Can someone give me a push in the right
direction? Thank you!
 
O

Ofer Cohen

You can use the form BeforeUpdate event to check if the fields are filled, if
not then stop the process

If Me.[CheckBoxName] = True And (Nz(me.[TextBox1],0) + Nz(me.[TextBox2],0)
+ Nz(me.[TextBox3],0) = 0) then
MsgBox "You need to apply a number"
Cancel = True ' Stop the process
End If
 
Top