Access Control Source

  • Thread starter Thread starter Ben Knox
  • Start date Start date
B

Ben Knox

I am trying to calculate a value by multipling two fields
in a form together, and using that result in another
field. I am using an IIF statement in the control source
property box of the form field that will hold the total,
to test to see if any of the values that will be
multiplied together are NULL. If either of the values
are null, then I want to enter information into the
field, if neither value is null then I want to place the
product of the two entries into the field. The IIF
statement looks like this:

IIF(IsNull(v1) Or IsNull(v2), HELP HERE, v1 * v2). The
question I have is the part that says HELP HERE. As most
of you know, using an equation in the control source box
results in the field being locked after the computation
is finished. Therefore, I cannot enter anything in to
it. What I am trying to do is best explained in an
example. Take Expense Reports for example. If you are
entering in a milage you should be able to enter the
distance and the rate and get the total. If you are
entering in a reciept then you should be able type the
total in and that is it.

Any help would be appreciated.
ben
 
You rarely want to store the result of a calculation back into the database.
This is a fundamental principle of database design. Instead, you should
just recalculate the value anytime you want it, in a query, a form, or a
report.
 
I would do that, but the value needs to be recorded in
the database for auditing purposes. The db and forms
were set up by someone else, and I am simply trying to
make them easier to use.

Ben
 
Back
Top