Solved

How to create multiple groups on Access report

Posted on 2016-11-17
5
32 Views
Last Modified: 2016-11-18
Hello all:

I am trying to create a report in Access 2010.  I have mutliple rows where one column either is 0 or 1.  What I would like to do is have a section or group of items where column1=0 and a group of items where column1 =1.  Then I can add separate headings and column names like the following:



Soda
Company       Flavor      Size
Pepsi              Cherry     12oz        
Coke               Grape      16oz

Food
Company       Item          Calories  
BK                      Whopper  1000
Mcd                   Nuggets    500    

So, my two groups are soda and food (0 or 1), columns are different based on group, and the data is displayed.

Any help on this would be greatly appreciated!
0
Comment
Question by:Juan Ocasio
  • 2
  • 2
5 Comments
 
LVL 36

Expert Comment

by:PatHartman
ID: 41892166
If the data you are displaying is different use two subreports.  One for each type.
0
 
LVL 14

Author Comment

by:Juan Ocasio
ID: 41892193
Thanks PatHartman:

Two questions:  How do you create a subreport in access 2010 and can you use the same Report Record Source?

Thanks!
0
 
LVL 36

Accepted Solution

by:
PatHartman earned 500 total points
ID: 41892267
You are showing two different sets of data.  Why would you want to mush them into the same form?  There is nothing to be gained by having to manipulate bound column names and captions on the fly.

A subreport is simply a report that you place onto another report.  Create the two new subreports, then drag each on to the detail section of the primary report.  Make sure that the master/child links are set properly so that Access will keep the reports in sync.  If you have defined relationships in the relationship window, Access will use those to set the master/child links for you.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 41892522
You may add a column to query: S_F: IIf([col]"0","SODA","FOOD") and sort report on S_F
On group header format event, modify label captions:
    If S_F = "FOOD" Then
        col1.Caption = "Food1"
        col2.Caption = "Food2"
    Else
        col1.Caption = "Soda1"
        col2.Caption = "Soda2"
   End If
0
 
LVL 14

Author Closing Comment

by:Juan Ocasio
ID: 41893908
thank you PatHartman
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question