A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How can I make a group not to show/display in a report if no data is under that group?



 
 
Thread Tools Display Modes
  #1  
Old July 28th, 2006, 05:10 PM posted to microsoft.public.access.reports
erick-flores
external usenet poster
 
Posts: 85
Default How can I make a group not to show/display in a report if no data is under that group?

Hello,

I have this big report that summary a lot of data. Sometimes a group
need to be shown if that group has data on it otherwire I dont want to
show the group in the report. So, is there an option to not show the
group if no data is under a group?

Any ideas?

Thank You

  #2  
Old July 28th, 2006, 06:29 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default How can I make a group not to show/display in a report if no data is under that group?

erick-flores wrote:
I have this big report that summary a lot of data. Sometimes a group
need to be shown if that group has data on it otherwire I dont want to
show the group in the report. So, is there an option to not show the
group if no data is under a group?



Add a text box with the expression =Coount(*) to the group
header section. Then use each section's Format event to
check the text box and cancel the section:

Cancel = (thetextbox = 0)

--
Marsh
MVP [MS Access]
  #3  
Old July 28th, 2006, 06:41 PM posted to microsoft.public.access.reports
erick-flores
external usenet poster
 
Posts: 85
Default How can I make a group not to show/display in a report if no data is under that group?


Marshall Barton wrote:
erick-flores wrote:
I have this big report that summary a lot of data. Sometimes a group
need to be shown if that group has data on it otherwire I dont want to
show the group in the report. So, is there an option to not show the
group if no data is under a group?



Add a text box with the expression =Coount(*) to the group
header section. Then use each section's Format event to
check the text box and cancel the section:

Cancel = (thetextbox = 0)

--
Marsh
MVP [MS Access]


Because I am grouping by different IDs I cant add another
field/expression to my grouping, can I?
I read you reply this to anoher person, and I already check for this
option

Any others suggestions?

  #4  
Old July 28th, 2006, 07:31 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default How can I make a group not to show/display in a report if no data is under that group?

erick-flores wrote:


Marshall Barton wrote:
erick-flores wrote:
I have this big report that summary a lot of data. Sometimes a group
need to be shown if that group has data on it otherwire I dont want to
show the group in the report. So, is there an option to not show the
group if no data is under a group?



Add a text box with the expression =Count(*) to the group
header section. Then use each section's Format event to
check the text box and cancel the section:

Cancel = (thetextbox = 0)


Because I am grouping by different IDs I cant add another
field/expression to my grouping, can I?
I read you reply this to anoher person, and I already check for this
option

Any others suggestions?



If it's not a report group, then I think you need to explain
what you mean by "group".

Another thought, how can there be data for the report when a
"group" has no data?

--
Marsh
MVP [MS Access]
  #5  
Old July 28th, 2006, 08:05 PM posted to microsoft.public.access.reports
erick-flores
external usenet poster
 
Posts: 85
Default How can I make a group not to show/display in a report if no data is under that group?

Ok, let me explain you. Compressors, Stages, Cylinders, Comp. Valve,
Comp. Parts, Gaskets, Piston, Comp. Rod, Nuts and Piston Rings

Compressor has Stage(s) (always)
Stage(s) has Cylinder(s) (always)
Cylinder can have Comp. Valve, Gaskets or Piston
Comp. Valve can have Comp. Parts
Cylinder can has Gasket
Piston can have Comp. Rod or Nuts
Nuts can have Piston Rings

So this si kind of the idea. I want to see my report first. group by:
1. Compressor (cmp_id)
2. Stages (stg_id)
3. Cylinders (cyl_id)
4. and then all the other components from the cylinders.

What I am doing:
1st group cmp_id
2nd group stg_id
3rd group cyl_id
4th group Comp Valve
5th group Comp. Parts
..
..
..
So I was thinking if a Cylinder only has a Gasket then only display the
gasket group.

I think there should be a better way of doing this, but I dont know

  #6  
Old July 28th, 2006, 08:27 PM posted to microsoft.public.access.reports
erick-flores
external usenet poster
 
Posts: 85
Default How can I make a group not to show/display in a report if no data is under that group?


Also when there is no data under a group, the others groups will not
work. So the hold report will display no data. It will only show the
group headers. How can I fix this? any ideas?

  #7  
Old July 28th, 2006, 08:29 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default How can I make a group not to show/display in a report if no data is under that group?

erick-flores wrote:

Ok, let me explain you. Compressors, Stages, Cylinders, Comp. Valve,
Comp. Parts, Gaskets, Piston, Comp. Rod, Nuts and Piston Rings

Compressor has Stage(s) (always)
Stage(s) has Cylinder(s) (always)
Cylinder can have Comp. Valve, Gaskets or Piston
Comp. Valve can have Comp. Parts
Cylinder can has Gasket
Piston can have Comp. Rod or Nuts
Nuts can have Piston Rings

So this si kind of the idea. I want to see my report first. group by:
1. Compressor (cmp_id)
2. Stages (stg_id)
3. Cylinders (cyl_id)
4. and then all the other components from the cylinders.

What I am doing:
1st group cmp_id
2nd group stg_id
3rd group cyl_id
4th group Comp Valve
5th group Comp. Parts
.
.
.
So I was thinking if a Cylinder only has a Gasket then only display the
gasket group.

I think there should be a better way of doing this, but I dont know



That seems like a good way to do it.

As far as I can tell from your description, I still think
you can use a text box named txtValveCount in the Valve
group's header section with the expression =Count(*)
Then the section can be suppressed by adding a line of code
to its Format event:
Cancel = (Me.txtValveCount = 0)
Repeat the same kind of thing in each group header.

If I am still misunderstanding what you are saying, please
post a Copy/Paste of the report's record source query along
with some explanation of how the fields are used in the
report.

--
Marsh
MVP [MS Access]
  #8  
Old July 28th, 2006, 09:30 PM posted to microsoft.public.access.reports
erick-flores
external usenet poster
 
Posts: 85
Default How can I make a group not to show/display in a report if no data is under that group?

As far as I can tell from your description, I still think
you can use a text box named txtValveCount in the Valve
group's header section with the expression =Count(*)
Then the section can be suppressed by adding a line of code
to its Format event:
Cancel = (Me.txtValveCount = 0)
Repeat the same kind of thing in each group header.


I think I dont quite understand what you mean, if I go to Sorting and
Grouping in my report, under the Field/Expression colunm I have:
cmp_id
stg_id
cyl_id
etc
So the header of my group shows: cmp_id Header, stg_id Header, etc
Do you mean add in that Field/Expression "=Count(*)"? So the name of
the group would be "Count(*) Header" is that what you mean. And the
txtValveCount, I cant add a textbox to the header, it wouldnt let me.
Maybe I am getting the wrong idea, perhaps I can use the txtValveCount.
If you can please guide me step by step I will really appreciatted

Thank you

  #9  
Old July 29th, 2006, 06:11 AM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default How can I make a group not to show/display in a report if no data is under that group?

erick-flores wrote:

As far as I can tell from your description, I still think
you can use a text box named txtValveCount in the Valve
group's header section with the expression =Count(*)
Then the section can be suppressed by adding a line of code
to its Format event:
Cancel = (Me.txtValveCount = 0)
Repeat the same kind of thing in each group header.


I think I dont quite understand what you mean, if I go to Sorting and
Grouping in my report, under the Field/Expression colunm I have:
cmp_id
stg_id
cyl_id
etc
So the header of my group shows: cmp_id Header, stg_id Header, etc
Do you mean add in that Field/Expression "=Count(*)"? So the name of
the group would be "Count(*) Header" is that what you mean. And the
txtValveCount, I cant add a textbox to the header, it wouldnt let me.
Maybe I am getting the wrong idea, perhaps I can use the txtValveCount.



No, no, not that at all.

Add a text box to the Valve group header. Double click on
this new text box to bring up its property sheet. Find the
Name property and type an appropriate name (e.g.
txtValveCount). Find the ControlSource property and type
=Count(*)
Now find the OnFormat property and select [Event Procedure]
from the drop down list. Then click on the builder button
in the right margin (the button with three dots). That
should take you to the headersection's Format event
procedure. Then just type the line:
Cancel = (Me.txtValveCount = 0)
into the procedure.

Test the report to see if the Valve section does what you
want when there are no valves. If it does, repeat the above
process for each of the other group header sections.

--
Marsh
MVP [MS Access]
  #10  
Old July 31st, 2006, 03:36 PM posted to microsoft.public.access.reports
erick-flores
external usenet poster
 
Posts: 85
Default How can I make a group not to show/display in a report if no data is under that group?

Add a text box to the Valve group header.
I add a text box to the fields under the Valve group header name:
gskCount. But not in the "group header"
When you say "Add a text box to the Valve group header" that for me is
create/add a text box inside the group header, where right now the
field is gsk_id. So I dont see how I can add a text box to the group
header. So I add it under the fields under my group header.

It did work when there is data under that group. I can see the textbox
counting the data. But when there is no data an error will occur.

"Run-time error '2427':
You entered an expression that has no value."
And it will highlight the "Cancel = (Me.gskCount = 0)"

My code behind the OnFormat is:
Private Sub GroupHeader6_Format(Cancel As Integer, FormatCount As
Integer)
Cancel = (Me.gskCount = 0)
End Sub

I am doing something wrong?

Thank you

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.