Do all four fields have a value? If any one of them is null (blank)
then the answer will be null. You can handle that by forcing a null
value to zero with the NZ function or by using an IIF expression
TotalPay: (Nz([Pay/CH],0) * Nz([CreditHours],0)) +
NZ([TravelAllowance],0) + NZ([PayAdjustment],0)
An alternative is to use something like the following.
TotalPay: (IIF([Pay/CH] is Null, 0,[Pay/Ch])
* IIF([CreditHours] is Null, 0, [CreditHours]))
+ IIF([TravelAllowance] Is Null,0,[TravelAllowance])
+ IIF([PayAdjustment] is Null, 0, [PayAdjustment])
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
I've entered the following expression in a query:
TotalPay: ([Pay/CH]*[CreditHours])+[TravelAllowance]+[PayAdjustment]
The query doesn't return the resulting calculation. What am I doing wrong?