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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top