How do I setup 1 or 2 fields being required out of 3? (Either or?

D

devastator442

Hello everyone,

I have been faced with a perplexing problem. I have three fields : General,
Software, and Module.

If General is filled out, then Software and Module must be blank.

If Software is filled out, General must be blank, module doesnt matter

If Module is filled out, then Software must be filled out, General must be
empty.

How can I accomplish this? I am completely lost...

Thanks!
 
O

Ofer

On the before update event of the form tou can add this code
If not isnull(me.General) and (not isnull(me.Software) or not
isnull(me.Module) then
msgbox "Software and Module must be blank"
cancel = true
exit sub
End if
If not isnull(me.Software) and not isnull(me.General ) hen
msgbox "General must be blank"
cancel = true
exit sub
End if
If not isnull(me.Module) and not isnull(me.General ) hen
msgbox "General must be blank"
cancel = true
me.General.setfocus
exit sub
End if
If not isnull(me.Module) and isnull(me.Software ) hen
msgbox "Software must be filled"
cancel = true
me.software.setfocus
exit sub
End if

If Module is filled out, then Software must be filled out, General must be
 
Top