Hide controls where the value is null

G

Guest

My report has a list of 100+ controls taken from a select query. Each of the
items only contains a numeric value and has a corresponding label. Like this:

Label Control Value
Donation Purpose 1 30.00
Donation Purpose 2 0.00
Donation Purpose 3 12.00
Donation Purpose 4 28.00
Donation Purpose 5 0.00

It currently displays every item, whether the value is zero or greater.
What I would like for it to do instead is to suppress or hide the items (&
their corresponding labels) with a zero value and to scoot the items with a
greater-than-zero value up to the next available spot on the list.

Label Control Value
Donation Purpose 1 30.00
Donation Purpose 3 12.00
Donation Purpose 4 28.00

Any suggestions gratefully received!
 
G

Guest

To the RecordSource of the report add a critera <> 0 Or > 0

Where [Control Value] <> 0

That will remove alll the records that are equal to 0
 
M

Marshall Barton

Super said:
My report has a list of 100+ controls taken from a select query. Each of the
items only contains a numeric value and has a corresponding label. Like this:

Label Control Value
Donation Purpose 1 30.00
Donation Purpose 2 0.00
Donation Purpose 3 12.00
Donation Purpose 4 28.00
Donation Purpose 5 0.00

It currently displays every item, whether the value is zero or greater.
What I would like for it to do instead is to suppress or hide the items (&
their corresponding labels) with a zero value and to scoot the items with a
greater-than-zero value up to the next available spot on the list.

Label Control Value
Donation Purpose 1 30.00
Donation Purpose 3 12.00
Donation Purpose 4 28.00

Any suggestions gratefully received!

Couple of ways. You can use a line of code for each text
box:
Me.textbox1.Visible = (Me.textbox1 <> 0)

Or, you can change all the labels to text boxes and use
expressions for both text boxes. The value expression could
be:
=IIf(field = 0, Null, field)
and the "label" text box expression:
=IIf(field = 0, Null, "Donation Purpose 1")

Either way, set all text boxes' and their section's
CanShrink property to Yes.
 
G

Guest

Thanks for this. I had a go, but because there is a seperate control for
each "control value" in my example, it wouldn't work, but I may try to
redesign things to see if I can make this work if I don't get any other
suggestions. Thanks for your time.

Ofer Cohen said:
To the RecordSource of the report add a critera <> 0 Or > 0

Where [Control Value] <> 0

That will remove alll the records that are equal to 0

--
Good Luck
BS"D


Super Wife Mom said:
My report has a list of 100+ controls taken from a select query. Each of the
items only contains a numeric value and has a corresponding label. Like this:

Label Control Value
Donation Purpose 1 30.00
Donation Purpose 2 0.00
Donation Purpose 3 12.00
Donation Purpose 4 28.00
Donation Purpose 5 0.00

It currently displays every item, whether the value is zero or greater.
What I would like for it to do instead is to suppress or hide the items (&
their corresponding labels) with a zero value and to scoot the items with a
greater-than-zero value up to the next available spot on the list.

Label Control Value
Donation Purpose 1 30.00
Donation Purpose 3 12.00
Donation Purpose 4 28.00

Any suggestions gratefully received!
 
G

Guest

Yippee this worked! The only thing is that the fields where there are values
greater than zero are dotted all down the page with big gaps in between where
the fields which equal zero are invisible. Any idea on how to make the ones
with values greater than zero appear one right after the other?
 
M

Marshall Barton

Which way did you decide to use?

Either you forgot to set some text box's or the Section's
CanShrink property or you have other non shrinking controls
next to the blank areas.
 
G

Guest

Thanks for the help. I tried the first way you suggested which worked and
have now set the "CanShrink" propety to Yes and have managed to get rid of
all the blank lines. Thanks again.

Marshall Barton said:
Which way did you decide to use?

Either you forgot to set some text box's or the Section's
CanShrink property or you have other non shrinking controls
next to the blank areas.
--
Marsh
MVP [MS Access]

Yippee this worked! The only thing is that the fields where there are values
greater than zero are dotted all down the page with big gaps in between where
the fields which equal zero are invisible. Any idea on how to make the ones
with values greater than zero appear one right after the other?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top