Solved

How to create a custom crosstab report

Posted on 2011-02-14
8
380 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
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.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

930 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

8 Experts available now in Live!

Get 1:1 Help Now