Solved

How to create a custom crosstab report

Posted on 2011-02-14
8
383 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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
 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

839 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