Solved

How to create a custom crosstab report

Posted on 2011-02-14
8
379 Views
Last Modified: 2012-08-13
Hello -
I am using Access 2003 to create a database to track contracts. I would like to create a report that would like to look something like this:
                                  P1        P2        P3
Expense 2010      100      120      90
Payment 2010       25        50        75
Difference            (75)    (125)  (150)  

The report would then list 2011, then 2012 below in the same format.
I have a Contract table with a unique ContractID key linking to a LineItems table in a one to many relationship. Then have ExpenseDetails table and PaymentDetails table linked to LineItems via a LineItemID field in a one to many relationship.

Does anyone have an idea how I can accomplish this? I tried crosstabs but could not get the row to subtract payments from expenses. Your help is deeply appreciated as I have been trying to resolve this for over a month now and no results. Please let me know if I need to provide additonal information to give better clarity.
Thanks,
CJ
0
Comment
Question by:cjarvis1128
8 Comments
 
LVL 18

Expert Comment

by:lludden
ID: 34891944
Put in the expenses as negative values, but when you are displaying them in the report, use ABS() around them.  Then you can just sum the columns for the difference.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34891971
upload a copy of the db...
0
 

Author Comment

by:cjarvis1128
ID: 34892055
Thanks for the response. Attached is a copy of the db.
Summary.mdb
0
 

Author Comment

by:cjarvis1128
ID: 34898048
lludden-
Thanks. That is actually a good suggestion but there are other options which I forgot to mention that needs to be considered in the calculation. The difference is actually as below:
P1 = Payments-Expenses
P2 = P1+Payments-Expenses
P3 = P2+Payments-Expenses
and so on..
I would also like to have the three rows to appear (calculation with zero) whether there are  payments entered or not. I am not sure if doing it in a form so its editable would be an option or even easier but open to that possibility.  
The report should be able to select the contract No or Contract Name in the header and show the relevant summary.
Thanks,
CJ
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34900418
Well a crosstab query won't easily display multiple "Year" groupings for years, like you have shown above...

                                  P1        P2        P3
Expense 2010      100      120      90
Payment 2010       25        50        75
Difference            (75)    (125)  (150)

                                  P1        P2        P3
Expense 2011      100      120      90
Payment 2011       20       73        12
Difference            (80)    (47)  (78)

You may have an easier time just filtering the crosstab query for one year at a time.
0
 

Accepted Solution

by:
cjarvis1128 earned 0 total points
ID: 34910167
Thanks Boaq2000. The powers that be wants to see this format so don't have a choice. I was thinking that a possible workaround would be to export the data to an excel template and create the summary via code there.

Based on responses to date I gather that my desired setup is overly cumbersome to create and I will proceed with attempts to 'build' the above workaround.
Most definitely appreciate the feedback.
CJ
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34911219
OK

Good luck.

Jeff
0
 

Author Closing Comment

by:cjarvis1128
ID: 35115342
I created an excel link into the database and implemented a workaround. Had excellent feedback from expert members but in the end the best solution to get the desired output was the workaround.
Thanks!
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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

747 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

13 Experts available now in Live!

Get 1:1 Help Now