View Single Post
  #21  
Old August 1st, 2006, 11:04 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:
Well I guess I am going to need some coding for my report. What I am
trying to do is a replica of a FoxPro application. This application
produces the same report that I am trying to create. This is what the
groups headers looks like:
^ Page Header
Tag Num
Business Team
^ Group Header 1: cmp_id===================================

Description
^ Group Header 2: stg_id====================================

Description
Components Material
Part#
^ Groups Header 3: cyl_id===================================

Under this group are all the different components that the cylinders
can have. They are all one on top of another, like you can see one line
of data, but if you start moving the texbox you can see that there are
5 texbox one of top of another. So I guess that there is some code
behind this group so I will print only if there is data behind a
particular component
^ Group Header 4: bom.type1 + STR(bom.id1)

Same thing for these group, but this group will show the components
under the cylinder components.
^ Group Header 5: bom.type2 + STR(bom.id2)

Here are the last components under the components from the cylinder
components
^ Detail
^ Group Footer 5: bom.type2 + STR (bom.id2)
^ Group Footer 4: bom.type1 + STR (bom.id1)
^ Group Footer 3: cyl_id
^ Group Footer 2: stg_id
^ Group Footer 1: cmp_id

^ Pafe Footer

I was trying to imitate this report in Access. But now that I know
Access dont more than 10 groups, I guess I need to put some code behind
my Groups (4,5 and Detail). Also if you notice all the arrows for the
groups are pointing up. In Access is the other way, the arrows for the
groups point down.

Do you have any ideas of how to create some code for my groups in
Access? So I can see my report the same as I see it in FoxPro? or
perhaps another complete different way, that will produce the
same/similar results?



It's starting to sound like you data is not normalized.
There should be a single field in the record source
table/query that contains the component type (e.g. Valve,
Gaskets or Piston) and another field for subtype (e.g.
Gasket, Rod, Nuts, etc). Maybe you even have a subsubtype
for rings? Anyway, these 3 or 4 fields are what should be
specified in Sorting and grouping. This would only require
3 or 4 groups, not more than 10.

If you have the valves in one set of fields, gaskets in
another set of field and Pistons in yet a third set of
fields, you have a mess that is better dealt with in a
spreadsheet where you can move things around manually till
it looks the way you want.

Anyway, assuming I'm wrong about how your data tables are
designed. You can make a single section display in a
different way depending on the type of the group by using
code in the Format event procedure to make some controls
visible and otheres invisible. It's pretty straightforward
if a little tedious.

--
Marsh
MVP [MS Access]