Link to home
Start Free TrialLog in
Avatar of travishaberman
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
Avatar of Raynard7
Raynard7

access will not do this for you.  it just is not designed to check for things like this.  you could in other larger rdms, but not in access.

as mentioned you can do this with vb but  you can not make the db do it for you.
Avatar of Rey Obrero (Capricorn1)
using a form for data entry you can check the values and enforce the rule in the
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
ASKER CERTIFIED SOLUTION
Avatar of stevbe
stevbe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of travishaberman

ASKER

THAT IS PERFECT.. Thank you!