Hiding Labels based on a criteria

A

Alain

Hi to all,

Here is my situation, I need to build a report that need to be formatted
based on some criteria, the detail section is made with 3 sub reports and
180 calculating fields based on the same criteria that I use for hiding
labels ( the calc fiels that show no data will remain blank therefore I use
the CanShrink property on the detail section which works just fine), the
general idea is that I have an amount that sometime need to be split in 2 or
3 , if I have no splits in the amount then I see only the main person that
will pay the full amount, If I have a split 2 way thant I see both persons
that will pay their share ect.....
I am using the following to format the detail section of the report:

If IsNull(Me.SplitCG) Or Me.SplitCG.Value = 0 Then
Me.Label502.Visible = False
Me.Label426.Visible = False
Me.Label422.Visible = False
Me.Line470.Visible = False
End If
On the first record, the code is working just fine, on the next record, the
code works also just fine since it hides my labels, my problem is when I
printpreview or print my report, I do not see the labels and lines on the
records that have splits but I do see the calc fields of the splits.

Can anybody tell me what I am missing here ???

Thanks in advance

Alain
 
A

Allen Browne

Your code hides the labels but it does not show them again (i.e. it never
sets the Visible back to True).

It may be simpler to replace the labels with text boxes that have this in
their Contol Source, so you don't need any code:
=IIf(Nz([SplitCG],0) = 0, Null, "What's in the caption of the label")
 
A

Alain

Thanks Allen, I,ll try this

Alain

Allen Browne said:
Your code hides the labels but it does not show them again (i.e. it never
sets the Visible back to True).

It may be simpler to replace the labels with text boxes that have this in
their Contol Source, so you don't need any code:
=IIf(Nz([SplitCG],0) = 0, Null, "What's in the caption of the label")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Alain said:
Here is my situation, I need to build a report that need to be formatted
based on some criteria, the detail section is made with 3 sub reports and
180 calculating fields based on the same criteria that I use for hiding
labels ( the calc fiels that show no data will remain blank therefore I
use the CanShrink property on the detail section which works just fine),
the general idea is that I have an amount that sometime need to be split
in 2 or 3 , if I have no splits in the amount then I see only the main
person that will pay the full amount, If I have a split 2 way thant I see
both persons that will pay their share ect.....
I am using the following to format the detail section of the report:

If IsNull(Me.SplitCG) Or Me.SplitCG.Value = 0 Then
Me.Label502.Visible = False
Me.Label426.Visible = False
Me.Label422.Visible = False
Me.Line470.Visible = False
End If
On the first record, the code is working just fine, on the next record,
the code works also just fine since it hides my labels, my problem is when
I printpreview or print my report, I do not see the labels and lines on
the records that have splits but I do see the calc fields of the splits.

Can anybody tell me what I am missing here ???

Thanks in advance

Alain
 
G

Guest

Your code hides the labels but it does not show them again (i.e. it never
sets the Visible back to True).

Hah! Thanks. I didn't ask the question, but recently asked a similar one.
Sometimes it is so easy to overlook something so simple (like making sure the
visible property is set to true if said conditions are not present).

Vel
 

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