Making fields conditionally dependant on the values of other fields?

  • Thread starter Grady W Smithey III
  • Start date
G

Grady W Smithey III

I am working on an order-entry form for my users, and need to make the value
of some fields conditionally dependant on the values of others. For
example, if FieldA = "NONE" then I need FieldB to have one value. If FieldA
= "YES" and FieldC = "OUT" then I need FieldB to have a different value, and
so on.

What is the best method for achieving this in Access 2000?
 
D

Douglas J. Steele

It can't be done through tables. You could probably accomplish it on a form,
using VBA, or else as computed fields in a query. Note that if you have
rules defined as that, then you should NOT be storing the value of FieldB in
the table.
 
G

Grady W Smithey III

Thanks for the tip, Doug. I'll start work on determining what the best
method will be fo rus.
 
C

Chris Mills

Like Doug, I think that writing code ("VBA") is the way to enforce your own
rules when Access does not cover it. That seems to apply to your case.

Of course, this does not prevent people violating your "rules", such as
manipulating the tables directly. But as a developer, you can't be too
concerned if they want to violate your system (your forms and underlying
code), apart from using security to disable the "database view".

Whenever you create your own rules (in code) which the database itself may not
enforce (such as, through Relationships), you should probably write some check
on the database, to be run once a month or whatever, to test for violations of
your "rule". This makes it easy to check if someone is "violating you".

Chris
 
G

Grady W Smithey III

I'm not worried about people trying to violate the rules - I'm trying to set
up an order-tracking database, and want it to calculate the costs (which can
be a raging pain when you have as many variables in each component's cost as
my folks do.)

Time to go get more up to speed on VBA then, obviously. :)
 

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

Top