travishaberman
asked on
VB Access DB Constraints
Hi Experts,
I am working with Access and VB. I need the to enforce some constraints at the DB. Specifically, have 4 yes/no fields in a table {F1, F2, F3, F4}.
I want the DB to enfoce the following constraint....
IF (F1 OR F2 OR F3) = True
THEN F4 must be true
... How can I add a constraint like this to my DB? To be clear, I know that I can check data as it goes into the DB and validate that the user has appropriatly entered F4=True if any of the other fields are... This is not good enough - I want the DB to through an error back at them....
Thanks so much,
-TRAVIS
I am working with Access and VB. I need the to enforce some constraints at the DB. Specifically, have 4 yes/no fields in a table {F1, F2, F3, F4}.
I want the DB to enfoce the following constraint....
IF (F1 OR F2 OR F3) = True
THEN F4 must be true
... How can I add a constraint like this to my DB? To be clear, I know that I can check data as it goes into the DB and validate that the user has appropriatly entered F4=True if any of the other fields are... This is not good enough - I want the DB to through an error back at them....
Thanks so much,
-TRAVIS
using a form for data entry you can check the values and enforce the rule in the
before update event of the form.
before update event of the form.
There is single table record validation in Access.
right click on the table (while it is open in design mode) and select properties ... you enter the validation rule and text (what you want displayed when the rule is broken)
there is even an example in the help file. (press F1 when you cursor in in either of these properties)
Steve
right click on the table (while it is open in design mode) and select properties ... you enter the validation rule and text (what you want displayed when the rule is broken)
there is even an example in the help file. (press F1 when you cursor in in either of these properties)
Steve
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
THAT IS PERFECT.. Thank you!
as mentioned you can do this with vb but you can not make the db do it for you.