I am having trouble attempting to figure out how to
perform calculations in fields? Can anyone tell me what
I am doing wrong? I am in the Control source of
properties for this particular field, and this is what I
have for my expression:
( «Expr» = [CMCR Table]![SalePrice] + [CMCR Table]!
[SalesTax] - [CMCR Table]![Discount] - [CMCR Table]!
[Deposit] )
Thanks
a) You can't do calculations in Fields.
Fields store data, not manipulate data.
b) You can perform calculations in unbound controls in a Form or in a
Report, or in a new column in a Query.
c) You haven't stated what your problem is, other than you're having a
problem, so how can anyone tell you what your problem is.
d) While this is posted in a formscoding newsgroup, you state that you
are trying to do this in a control's control source.
As a guess, try it this way:
= Nz([SalePrice]) + Nz([SalesTax]) - Nz([Discount]) - Nz([Deposit])
The above assumes that all of the above 4 fields are included in your
form's record source, and that [Discount] is a currency amount, i.e.
$5.00, not a percentage, i.e. 15%.. and that possibly, one of the
fields used in the expression might be empty (Null).
Make sure the name of this control is not the same as the name of one
of the fields used in the expression. Use an Unbound control.
The above calculation will appear on your form, however it is not, nor
should it be, actually stored in any Field in a table. Whenever you
need the results of the calculation, re-calculate it.
Now if the above does not work, it's going to be up to you to let us
know what you're doing, when you're doing it, and where, with a short
example of your data, and what your result should be, as well as what
result you're actually getting.