I am trying to conditionally print a field on a report based on the
value of another field in the query that the report is based on.
In the Control Source for SerialB I have typed:
= IIF(nz(QtyB) > 0," ",SerialB)
On preview of the report I get #Error in that field every time QtyB is
NOT greater than 0.
If I change the code to read:
= IIF(nz(QtyB) > 0," ","9")
the blank shows up where it should and the 9 shows up where it should.
Can someone please tell me how to make this work? Thanks
- jc -
Bill (The Original) - 16 Feb 2006 20:23 GMT
Create a field in the query using your formula.
e.g., createdfield: = IIF(nz(QtyB) > 0," ",SerialB).
Then use createdfield in the report.
Or
Put SerialB in the report and hide it from view.
(Make the box tiny or change the font color)
If you refer to SerialB in a formula as its control source in a report,
then you must have SerialB somewhere else in the report for the formula
to reference. Formulas with self referential components generally end
up
as non functioning circular references. Is that confusing enough?
JC - 17 Feb 2006 12:28 GMT
Bill, Thank you! Adding the created fields in the underlying query
worked GREAT! - BUT - I could not get the other solution to work. I
tried putting both fields on the report, but it still gave the #Error.
I understand what you are saying about self referential components, but
it does seem like it "ought" to work. No matter - I am moving on since
you have given me a solution that works. Thanks again.
- jc -
PS - I LOVE this forum. - so much knowledge right at my fingertips...