Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to determine if field exists in report...

Status
Not open for further replies.

MushMouse

Programmer
Mar 29, 2004
65
US
I have a report that consists of several subreports.
In the report, I total the fields of the subreports.
But if one of the subreports has no data, the total gives me #ERROR
I would like it to just count that field as a 0.

Any ideas for how to accomplish this would be much appreciated!
 
Have you tried to play with the Nz function ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I tried Nz. It works if you have no value in a record that exists.
But it doesn't seem to be working when the record doesn't even exist (which is the case in the subreport - no values met the criteria I entered, so I guess the subreport doesn't exist, & that one line in my report doesn't exist...)

Any other ideas?
 
Any other ideas?
Finally yes: post in the MS Access reports forum.
 
Use IsError to test each total as you aggregate. like

IIf(Iserror(subtotal1),0,subtotal1) + IIf(Iserror(subtotal2),0,subtotal2) ....






The early bird gets the worm, but the second mouse gets the cheese.
 
You may want to also review the IsNull, IsError, and IsEmpty functions. I often get confused on which one to use, but all are very useful.


Syntax: IsError(expression)
The required expression argument can be any valid expression.

Remarks

Error values are created by converting real numbers to error values using the CVErr function. The IsError function is used to determine if a numeric expression represents an error. IsError returns True if the expression argument indicates an error; otherwise, it returns False.



IsEmpty Function Example
Returns a Boolean value indicating whether an expression is an error value.

This example uses the IsEmpty function to determine whether a variable has been initialized.

Dim MyVar, MyCheck
MyCheck = IsEmpty(MyVar) ' Returns True.

MyVar = Null ' Assign Null.
MyCheck = IsEmpty(MyVar) ' Returns False.

MyVar = Empty ' Assign Empty.
MyCheck = IsEmpty(MyVar) ' Returns True.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top