Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to create a custom crosstab report

Posted on 2011-02-14
8
Medium Priority
?
400 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

721 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