Solved

How to create multiple groups on Access report

Posted on 2016-11-17
5
18 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 34

Expert Comment

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

Author Comment

by:Juan Ocasio
Comment Utility
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 34

Accepted Solution

by:
PatHartman earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
thank you PatHartman
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now