# Error

martinw

Registered User.
Local time
Today, 18:46
Joined
Oct 31, 2001
Messages
11
I have created a report called Reportcard that gets information from 2 other reports (one, absent, adds absentees and the other, tardy, adds tardies).
I am using the following: =IIf(Nz([F1])="","0",Count([F1])) to count the records. This works great and gives me the values I need in a text box on the form.
If there is a record to count the correct number is passed to the reportcard report.
The problem I encounter is when there are no records to count the text box shows "0" which is good but when I try to pass that to the reportcard report I get "# Error".
How can I pass the "0" to the reportcard report?
 
is the field displaying the #error referenced correctly in the report?
 
No, In the absentee report textbox I have a "0" which is what I want. But when I pass that value to the Reportcard report it comes across as a "#Error".
 
You are using the Nz() function improperly. It should have an additional parameter. I know you can get away with this in VBA but, then you need to understand what the default will be when you don't specify a parameter. As written, your IIf() will never return true because the value of Nz([F1]) will never be "". It will be 0 if F1 was null or whatever value F1 contained that was not null. Therefore, just substitute -
=Count(Nz([F1],0))
 
It does not work. It is now passing "#Error" for any count whether it is null or not.
 
This probably won't be comforting but, I'm having a similar problem. The following code works BUT... I get a null if there is a divide by 0. That's sort of okay. I'd rather have a 0 than a null, but I'll take a null over an #error or a #Num!

=Sum(IIf(Nz([Prod_List] Like '*Floor',[Weigh_Net])/2000,0))/Sum(IIf([Prod_List] Like '*Floor',1,0))
 

Users who are viewing this thread

Back
Top Bottom