Hiding fields in report

H

Humphrey

I have a detail section that contains a photo and a text box and under them
in the same section are another photo and text box. If both the second text
box and photo are blank I want to make them both invisible and have the
detail section reduce in size.
I've written the VBA to set the properties of the second set to invisible
and housed it in the Detail_Print section. The problem is the effect is not
felt until the next record. That is if the detail should hide the photo in
the current record, it is the following record that has it hidden and if it
should be shown in the current record it is the following record that has it
shown.
I understand why it doing what it is doing, my question is how do I get it
to determine whether the photo should be hidden in the current section and
make the appropriate changes?

H
 
M

Marshall Barton

Humphrey said:
I have a detail section that contains a photo and a text box and under them
in the same section are another photo and text box. If both the second text
box and photo are blank I want to make them both invisible and have the
detail section reduce in size.
I've written the VBA to set the properties of the second set to invisible
and housed it in the Detail_Print section. The problem is the effect is not
felt until the next record. That is if the detail should hide the photo in
the current record, it is the following record that has it hidden and if it
should be shown in the current record it is the following record that has it
shown.
I understand why it doing what it is doing, my question is how do I get it
to determine whether the photo should be hidden in the current section and
make the appropriate changes?


To affect the layout of a report section, you must use the
Format event.

Another important point is that you need to set the Visible
(or any other property) to the correct setting for every
record. This means that you can not get by with code like:
If <some condition> Then
Me.somecontrol.Visible = Fals e
End if

Instead you must have code like:
If <some condition> Then
Me.somecontrol.Visible = Fals e
Else
Me.somecontrol.Visible = True
End if

Or, in the case of properties, such as Visible, that have a
True/False setting, the code can be shortened to:
Me.somecontrol.Visible = Not <some condition>
 

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

Similar Threads


Top