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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Printing Variables 1

Status
Not open for further replies.

ebrooks54

IS-IT--Management
Dec 4, 2002
54
US
Is there a way in Access to only print a value in a report if it contains something meaningful (IE non-zero)?

I have a record with multiple tax jurisdictions in it, and I only want to print the description and the value, if the value is non-zero. If the value is zero, it should print nothing, not even a blank line.

For example, on any given record there may be GST and PST, but no HST, or HST and no GST/PST. In the first case I want to print a line with the GST and a line with the PST. In the second case I only want to print a line with the HST.
 
It sounds a bit like your table is un-normalized. However, you can use text boxes for both the label and the value.
[tt]
Label
Name: lblGST
Control Source: =IIf(Nz([GST],0)=0,Null,"GST")
Can Shrink: Yes

Value
Name: txtGST
Control Source: =IIf(Nz([GST],0)=0,Null,[GST])
Can Shrink: Yes
[/tt]
This should hide all null and 0 valued fields.

Duane
Hook'D on Access
MS Access MVP
 
This is brilliantly simple to suppress the printing of a zero value. I'm not sure that the 'can shrink' parameter is working, though.

It appears that the space that the field would take is still being reserved. That's a minor issue, I can live with.
 
Temporarily set the borders of your controls to display so you can determine if the controls are actually shrinking. The shrinking will have no effect if there are controls to the left of right of the shrinkers.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top