not display report header when fields are empty

C

chuck

I have a report which uses three levels of grouping. The form layout looks
something like this:

PageHeader
[table1col1]
GroupHeader1
[table2col1]
[table2col2]
GroupHeader2
[table3col1]
[table3col2]
GroupHeader3
[table4col1]
[table4col2]

The record source of the report is actually a query which joins the values
of 4 different tables. Each GroupHeader in the report contains values from
one of those tables. For a particular record, if a top level header
contains no data, then a lower level header will be empty also.

Everything works fine excepts that when a particular group's records are
empty or null, i don't want the controls to display.

For example, here is a typical report for one of the records for the
"Galaxy" table.

Galaxy: MilkyWay --------------PageHeader
Star System: Solar system ------GroupHeader1
Planet: Earth ----------------GroupHeader2
Satellite: Moon ----------GroupHeader3
Planet: Saturn
Satellite: Mimas
Satellite: Tethys
Satellite: Dione
Satellite: Titan
Planet: Mercury
Satellite:
Star System: otherstarsystem
Planet:
Satellite:

I want the report to look like this, without the labels showing up when
there are no records in that group, and preferably without the headers
taking up any vertical space

Galaxy: MilkyWay
Star System: Solar system
Planet: Earth
Satellite: Moon
Planet: Saturn
Satellite: Mimas
Satellite: Tethys
Satellite: Dione
Satellite: Titan
Planet: Mercury
Star System: otherstarsystem

Is this possible ? Conditional formatting only works on textbox controls and
combobox controls (?) so that won't work. Any other methods someone can
suggest ?

Thanks

Chuck
 
M

Marshall Barton

chuck said:
I have a report which uses three levels of grouping. The form layout looks
something like this:

PageHeader
[table1col1]
GroupHeader1
[table2col1]
[table2col2]
GroupHeader2
[table3col1]
[table3col2]
GroupHeader3
[table4col1]
[table4col2]

The record source of the report is actually a query which joins the values
of 4 different tables. Each GroupHeader in the report contains values from
one of those tables. For a particular record, if a top level header
contains no data, then a lower level header will be empty also.

Everything works fine excepts that when a particular group's records are
empty or null, i don't want the controls to display.

For example, here is a typical report for one of the records for the
"Galaxy" table.

Galaxy: MilkyWay --------------PageHeader
Star System: Solar system ------GroupHeader1
Planet: Earth ----------------GroupHeader2
Satellite: Moon ----------GroupHeader3
Planet: Saturn
Satellite: Mimas
Satellite: Tethys
Satellite: Dione
Satellite: Titan
Planet: Mercury
Satellite:
Star System: otherstarsystem
Planet:
Satellite:

I want the report to look like this, without the labels showing up when
there are no records in that group, and preferably without the headers
taking up any vertical space

Galaxy: MilkyWay
Star System: Solar system
Planet: Earth
Satellite: Moon
Planet: Saturn
Satellite: Mimas
Satellite: Tethys
Satellite: Dione
Satellite: Titan
Planet: Mercury
Star System: otherstarsystem

Is this possible ? Conditional formatting only works on textbox controls and
combobox controls (?) so that won't work. Any other methods someone can
suggest ?


Use the Format event of each section to cancel the event
when the section's significant field is null. For example.
the detail section's Format event:
Cancel = IsNull(Me.Satellite)
Or for the star system group header section:
Cancel = IsNull(Me.Planet)

There is a way to do this without code if your real
situation is as trivial as your example, but the code is
very simple and more general.
 
C

chuck

Oh man, I wish I had asked the question a few weeks ago!!

So simple. Works great, thanks a bunch.


Marshall Barton said:
chuck said:
I have a report which uses three levels of grouping. The form layout
looks
something like this:

PageHeader
[table1col1]
GroupHeader1
[table2col1]
[table2col2]
GroupHeader2
[table3col1]
[table3col2]
GroupHeader3
[table4col1]
[table4col2]

The record source of the report is actually a query which joins the values
of 4 different tables. Each GroupHeader in the report contains values
from
one of those tables. For a particular record, if a top level header
contains no data, then a lower level header will be empty also.

Everything works fine excepts that when a particular group's records are
empty or null, i don't want the controls to display.

For example, here is a typical report for one of the records for the
"Galaxy" table.

Galaxy: MilkyWay --------------PageHeader
Star System: Solar system ------GroupHeader1
Planet: Earth ----------------GroupHeader2
Satellite: Moon ----------GroupHeader3
Planet: Saturn
Satellite: Mimas
Satellite: Tethys
Satellite: Dione
Satellite: Titan
Planet: Mercury
Satellite:
Star System: otherstarsystem
Planet:
Satellite:

I want the report to look like this, without the labels showing up when
there are no records in that group, and preferably without the headers
taking up any vertical space

Galaxy: MilkyWay
Star System: Solar system
Planet: Earth
Satellite: Moon
Planet: Saturn
Satellite: Mimas
Satellite: Tethys
Satellite: Dione
Satellite: Titan
Planet: Mercury
Star System: otherstarsystem

Is this possible ? Conditional formatting only works on textbox controls
and
combobox controls (?) so that won't work. Any other methods someone can
suggest ?


Use the Format event of each section to cancel the event
when the section's significant field is null. For example.
the detail section's Format event:
Cancel = IsNull(Me.Satellite)
Or for the star system group header section:
Cancel = IsNull(Me.Planet)

There is a way to do this without code if your real
situation is as trivial as your example, but the code is
very simple and more general.
 

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

New books 10

Top