I am running this application in Access 97 and need to show results using
this calculation:
=(IIf([rpt_Product_TequilaInfoData_Collection_PrevDay].[Report].[HasData],[rpt_Product_TequilaInfoData_Collection_PrevDay].[Report]![txt_ActualOnHndSales],0)+IIf([rpt_Product_TequilaInfoData_Collection_PrevDay].[Report].[HasData],[rpt_Product_TequilaInfoData_Collection_PrevDay].[Report]![txt_OpenBtlSales],0))-(IIf([rpt_Product_TequilaInfoData_Collection_Daily].[Report].[HasData],[rpt_Product_TequilaInfoData_Collection_Daily].[Report]![txt_ActualOnHndSales],0)+IIf([rpt_Product_TequilaInfoData_Collection_Daily].[Report].[HasData],[rpt_Product_TequilaInfoData_Collection_Daily].[Report]![txt_OpnBtlSales],0))
=================
What happens is that the first two references are added together, then, the
next two are deducted rom the first two. What I need to do is, if either of
the first two have a value and the the last two do not, show the total of the
first two anyway! The very first value will almost always be a higher value
than the last two, thus, I'd like to show the result of that value minus the
last two, even if the second of the first two values may be missing!
Currently, if any value is missing, I end-up with no results of a blank
space for the control which is to show the results.
I hope that I've explianed what I'm trying to accomplish. If I was not as
clear as I think, then, please post back with further questions on the matter!
Thanks,
Pat Hartman(MVP) - 29 Oct 2005 22:44 GMT
When data that you need to use in calculations may be null, you can use the
Nz() function.
Nz([rpt_Product_TequilaInfoData_Collection_PrevDay].[Report]![txt_ActualOnHndSales],0)
- Just change all the fields this way. Nz is the Null to Zero function but
if you want it to return any other value, just substitute if for the 0.
Nz(someTextField, "Empty") or Nz(someNumericField, 245) for example. The
default is 0 for numeric fields and "" for text fields. "" is a Zero Length
String. Do not confuse it with null.
>I am running this application in Access 97 and need to show results using
> this calculation:
[quoted text clipped - 22 lines]
>
> Thanks,