Using MS Access/Crosstab

Advertisement


Question
I have table as below:
Item   Tot   Year   comments
A   100   2010   
B   200   2010   
C   300   2010   
A   100   2011   
B   188   2011   sent out
C   300   2011   
A   100   2012   
B   200   2012   
C   250   2012   Used

I need to generate a report as:
Item   2010  2010-notes 2011 2011-notes 2012 2012-notes
A   100       100       100   
B   200       188  sent out    200   
C   300       300       250   Used

Can i do this report in MS ACCESS 2010? If Yes, How?
 Thanks in advance!

Answer
You are going to have do this with multiple queries. First a crosstab query to get the Total by year for each Item. Next you will have to do a group by query, that groups by Item and year and concatenates the comments into one record. You will need a function like this one: http://access.mvps.org/access/modules/mdl0008.htm

Next you create another crosstab to get the grid for the notes. Then join the 2 crosstabs on Item to get all the columns.

Hope this helps,
Scott<>
Blog: http://scottgem.wordpress.com
Website: http://www.diamondassoc.com
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.