473,385 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Creating a total from a tricky report

Hi,

Here is my problem:

I have a report which lists Application numbers, Offer numbers and Firm Replies numbers for a subject i.e. Geography as 3 rows. My column headings also list subjects so you can see the Joint Honours combinations. As not all Subject combinations are possible there are many null fields. For example Geography with Geography. With a rather large IIf statement in a text box I can create a row total, but I want an overall total of just subject applications and that overall total divided by 2 to get the number of applications.

I know this might be tricky to understand I'll try to show you what I mean.

SUBJECT ___________|__Geography_|_History_|_Maths_|_TOTAL_
Geography Applications|____________|___20___|__15___|__[IIf..
Geography Offers_____|____________|____8___|__10___|__[IIf..
Geography Firm Replies|____________|____4___|__6____|__[IIf..
History Applications ___|_____20_____|________|__13___|__[IIf..
History Offers_________|______8_____|________|__12___|__[IIf..
History Firm Replies...
etc.


I would like:______________________________[Total Applications]
_______________________________________(Total Applications]/2)

Then presumably if this is possible I could create totals of offers and firm replies also?

You time and help is greatly appreciated.
May 1 '09 #1
4 1405
NeoPa
32,556 Expert Mod 16PB
You would need to use the Sum() function in your Application Total calculation. To determine how to phrase the IIf() function call within that, we'd need a look at the Record Source (SQL) of the report. We'd be hoping for a flag of some sort on a line basis that differentiates the applications from the others.

I'm just hoping it's not a CrossTab query.
May 1 '09 #2
It's based on 3 joint select queries as a union, which are each based on 2 crosstab queries as a union.

Expand|Select|Wrap|Line Numbers
  1. SELECT JOINTHONAPPUNION.APPS, Sum(JOINTHONAPPUNION.[ABUSE STUDIES]) AS [SumOfABUSE STUDIES], Sum(JOINTHONAPPUNION.BUSINESS) AS SumOfBUSINESS, Sum(JOINTHONAPPUNION.[CHILDHOOD AND YOUTH STUDIES]) AS [SumOfCHILDHOOD AND YOUTH STUDIES], Sum(JOINTHONAPPUNION.[COACHING STUDIES]) AS [SumOfCOACHING STUDIES], Sum(JOINTHONAPPUNION.[CREATIVE MUSIC PRODUCTIONS]) AS [SumOfCREATIVE MUSIC PRODUCTIONS], Sum(JOINTHONAPPUNION.[CREATIVE WRITING]) AS [SumOfCREATIVE WRITING], Sum(JOINTHONAPPUNION.[CRIME STUDIES]) AS [SumOfCRIME STUDIES], Sum(JOINTHONAPPUNION.[CULTURAL STUDIES]) AS [SumOfCULTURAL STUDIES], Sum(JOINTHONAPPUNION.DANCE) AS SumOfDANCE, Sum(JOINTHONAPPUNION.DRAMA) AS SumOfDRAMA, Sum(JOINTHONAPPUNION.[EDUCATION STUDIES]) AS [SumOfEDUCATION STUDIES], Sum(JOINTHONAPPUNION.ENGLISH) AS SumOfENGLISH, Sum(JOINTHONAPPUNION.[EXERCISE & PHYSICAL ACTIVITY]) AS [SumOfEXERCISE & PHYSICAL ACTIVITY], Sum(JOINTHONAPPUNION.[FILM AND TELEVISION STUDIES]) AS [SumOfFILM AND TELEVISION STUDIES], Sum(JOINTHONAPPUNION.[FINANCIAL MANAGEMENT]) AS [SumOfFINANCIAL MANAGEMENT], Sum(JOINTHONAPPUNION.GEOGRAPHY) AS SumOfGEOGRAPHY, Sum(JOINTHONAPPUNION.[HEALTH STUDIES]) AS [SumOfHEALTH STUDIES], Sum(JOINTHONAPPUNION.[HUMAN RESOURCE MANAGEMENT]) AS [SumOfHUMAN RESOURCE MANAGEMENT], Sum(JOINTHONAPPUNION.[INFORMATION TECHNOLOGY MANAGEMENT]) AS [SumOfINFORMATION TECHNOLOGY MANAGEMENT], Sum(JOINTHONAPPUNION.[JUSTICE AND THE ENVIRONMENT]) AS [SumOfJUSTICE AND THE ENVIRONMENT], Sum(JOINTHONAPPUNION.[LEGAL STUDIES]) AS [SumOfLEGAL STUDIES], Sum(JOINTHONAPPUNION.[LEISURE MANAGEMENT]) AS [SumOfLEISURE MANAGEMENT], Sum(JOINTHONAPPUNION.MARKETING) AS SumOfMARKETING, Sum(JOINTHONAPPUNION.MUSIC) AS SumOfMUSIC, Sum(JOINTHONAPPUNION.[OUTDOOR STUDIES]) AS [SumOfOUTDOOR STUDIES], Sum(JOINTHONAPPUNION.PHILOSOPHY) AS SumOfPHILOSOPHY, Sum(JOINTHONAPPUNION.[POPULAR MUSICS]) AS [SumOfPOPULAR MUSICS], Sum(JOINTHONAPPUNION.PSYCHOLOGY) AS SumOfPSYCHOLOGY, Sum(JOINTHONAPPUNION.SOCIOLOGY) AS SumOfSOCIOLOGY, Sum(JOINTHONAPPUNION.SPORT) AS SumOfSPORT, Sum(JOINTHONAPPUNION.[SPORT DEVELOPMENT]) AS [SumOfSPORT DEVELOPMENT]
  2. FROM JOINTHONAPPUNION
  3. GROUP BY JOINTHONAPPUNION.APPS;
  4. UNION
  5. SELECT JOINTHONOFFUNION.OFFERS, Sum(JOINTHONOFFUNION.[ABUSE STUDIES]) AS [SumOfABUSE STUDIES], Sum(JOINTHONOFFUNION.BUSINESS) AS SumOfBUSINESS, Sum(JOINTHONOFFUNION.[CHILDHOOD AND YOUTH STUDIES]) AS [SumOfCHILDHOOD AND YOUTH STUDIES], Sum(JOINTHONOFFUNION.[COACHING STUDIES]) AS [SumOfCOACHING STUDIES], Sum(JOINTHONOFFUNION.[CREATIVE MUSIC PRODUCTIONS]) AS [SumOfCREATIVE MUSIC PRODUCTIONS], Sum(JOINTHONOFFUNION.[CREATIVE WRITING]) AS [SumOfCREATIVE WRITING], Sum(JOINTHONOFFUNION.[CRIME STUDIES]) AS [SumOfCRIME STUDIES], Sum(JOINTHONOFFUNION.[CULTURAL STUDIES]) AS [SumOfCULTURAL STUDIES], Sum(JOINTHONOFFUNION.DANCE) AS SumOfDANCE, Sum(JOINTHONOFFUNION.DRAMA) AS SumOfDRAMA, Sum(JOINTHONOFFUNION.[EDUCATION STUDIES]) AS [SumOfEDUCATION STUDIES], Sum(JOINTHONOFFUNION.ENGLISH) AS SumOfENGLISH, Sum(JOINTHONOFFUNION.[EXERCISE & PHYSICAL ACTIVITY]) AS [SumOfEXERCISE & PHYSICAL ACTIVITY], Sum(JOINTHONOFFUNION.[FILM AND TELEVISION STUDIES]) AS [SumOfFILM AND TELEVISION STUDIES], Sum(JOINTHONOFFUNION.[FINANCIAL MANAGEMENT]) AS [SumOfFINANCIAL MANAGEMENT], Sum(JOINTHONOFFUNION.GEOGRAPHY) AS SumOfGEOGRAPHY, Sum(JOINTHONOFFUNION.[HEALTH STUDIES]) AS [SumOfHEALTH STUDIES], Sum(JOINTHONOFFUNION.[HUMAN RESOURCE MANAGEMENT]) AS [SumOfHUMAN RESOURCE MANAGEMENT], Sum(JOINTHONOFFUNION.[INFORMATION TECHNOLOGY MANAGEMENT]) AS [SumOfINFORMATION TECHNOLOGY MANAGEMENT], Sum(JOINTHONOFFUNION.[JUSTICE AND THE ENVIRONMENT]) AS [SumOfJUSTICE AND THE ENVIRONMENT], Sum(JOINTHONOFFUNION.[LEGAL STUDIES]) AS [SumOfLEGAL STUDIES], Sum(JOINTHONOFFUNION.[LEISURE MANAGEMENT]) AS [SumOfLEISURE MANAGEMENT], Sum(JOINTHONOFFUNION.MARKETING) AS SumOfMARKETING, Sum(JOINTHONOFFUNION.MUSIC) AS SumOfMUSIC, Sum(JOINTHONOFFUNION.[OUTDOOR STUDIES]) AS [SumOfOUTDOOR STUDIES], Sum(JOINTHONOFFUNION.PHILOSOPHY) AS SumOfPHILOSOPHY, Sum(JOINTHONOFFUNION.[POPULAR MUSICS]) AS [SumOfPOPULAR MUSICS], Sum(JOINTHONOFFUNION.PSYCHOLOGY) AS SumOfPSYCHOLOGY, Sum(JOINTHONOFFUNION.SOCIOLOGY) AS SumOfSOCIOLOGY, Sum(JOINTHONOFFUNION.SPORT) AS SumOfSPORT, Sum(JOINTHONOFFUNION.[SPORT DEVELOPMENT]) AS [SumOfSPORT DEVELOPMENT]
  6. FROM JOINTHONOFFUNION
  7. GROUP BY JOINTHONOFFUNION.OFFERS;
  8. UNION SELECT JOINTHONFIRMUNION.[FIRM REP], Sum(JOINTHONFIRMUNION.[ABUSE STUDIES]) AS [SumOfABUSE STUDIES], Sum(JOINTHONFIRMUNION.BUSINESS) AS SumOfBUSINESS, Sum(JOINTHONFIRMUNION.[CHILDHOOD AND YOUTH STUDIES]) AS [SumOfCHILDHOOD AND YOUTH STUDIES], Sum(JOINTHONFIRMUNION.[COACHING STUDIES]) AS [SumOfCOACHING STUDIES], Sum(JOINTHONFIRMUNION.[CREATIVE MUSIC PRODUCTIONS]) AS [SumOfCREATIVE MUSIC PRODUCTIONS], Sum(JOINTHONFIRMUNION.[CREATIVE WRITING]) AS [SumOfCREATIVE WRITING], Sum(JOINTHONFIRMUNION.[CRIME STUDIES]) AS [SumOfCRIME STUDIES], Sum(JOINTHONFIRMUNION.[CULTURAL STUDIES]) AS [SumOfCULTURAL STUDIES], Sum(JOINTHONFIRMUNION.DANCE) AS SumOfDANCE, Sum(JOINTHONFIRMUNION.DRAMA) AS SumOfDRAMA, Sum(JOINTHONFIRMUNION.[EDUCATION STUDIES]) AS [SumOfEDUCATION STUDIES], Sum(JOINTHONFIRMUNION.ENGLISH) AS SumOfENGLISH, Sum(JOINTHONFIRMUNION.[EXERCISE & PHYSICAL ACTIVITY]) AS [SumOfEXERCISE & PHYSICAL ACTIVITY], Sum(JOINTHONFIRMUNION.[FILM AND TELEVISION STUDIES]) AS [SumOfFILM AND TELEVISION STUDIES], Sum(JOINTHONFIRMUNION.[FINANCIAL MANAGEMENT]) AS [SumOfFINANCIAL MANAGEMENT], Sum(JOINTHONFIRMUNION.GEOGRAPHY) AS SumOfGEOGRAPHY, Sum(JOINTHONFIRMUNION.[HEALTH STUDIES]) AS [SumOfHEALTH STUDIES], Sum(JOINTHONFIRMUNION.[HUMAN RESOURCE MANAGEMENT]) AS [SumOfHUMAN RESOURCE MANAGEMENT], Sum(JOINTHONFIRMUNION.[INFORMATION TECHNOLOGY MANAGEMENT]) AS [SumOfINFORMATION TECHNOLOGY MANAGEMENT], Sum(JOINTHONFIRMUNION.[JUSTICE AND THE ENVIRONMENT]) AS [SumOfJUSTICE AND THE ENVIRONMENT], Sum(JOINTHONFIRMUNION.[LEGAL STUDIES]) AS [SumOfLEGAL STUDIES], Sum(JOINTHONFIRMUNION.[LEISURE MANAGEMENT]) AS [SumOfLEISURE MANAGEMENT], Sum(JOINTHONFIRMUNION.MARKETING) AS SumOfMARKETING, Sum(JOINTHONFIRMUNION.MUSIC) AS SumOfMUSIC, Sum(JOINTHONFIRMUNION.[OUTDOOR STUDIES]) AS [SumOfOUTDOOR STUDIES], Sum(JOINTHONFIRMUNION.PHILOSOPHY) AS SumOfPHILOSOPHY, Sum(JOINTHONFIRMUNION.[POPULAR MUSICS]) AS [SumOfPOPULAR MUSICS], Sum(JOINTHONFIRMUNION.PSYCHOLOGY) AS SumOfPSYCHOLOGY, Sum(JOINTHONFIRMUNION.SOCIOLOGY) AS SumOfSOCIOLOGY, Sum(JOINTHONFIRMUNION.SPORT) AS SumOfSPORT, Sum(JOINTHONFIRMUNION.[SPORT DEVELOPMENT]) AS [SumOfSPORT DEVELOPMENT]
  9. FROM JOINTHONFIRMUNION
  10. GROUP BY JOINTHONFIRMUNION.[FIRM REP];
  11.  
The way the applications, offers and firm replies differ is that I added the text to the field as an expression.

Sorry for all that.
May 1 '09 #3
Ok I've fixed my problem, though slighlty fudged.

I created a select query off the big query above summing each subject and made an IIf expression in the row subject and grouped by so it returned Applications, Offers and Firm Replies. Then in a report I could sum these and divide by 2.

Then I added this as a subreport into the original in the report footer and lined up the appropriate fields.

Phew
May 1 '09 #4
NeoPa
32,556 Expert Mod 16PB
Yes. That's a relief. I hardly ever use CrossTabs. That would have been a struggle to work on.

Well done :)
May 1 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rajani | last post by:
Hello, I have a table(msaccess) with the structure... job_code text 6 style text 10 qty number fabrication text 65 ship_date date/time
3
by: Greg | last post by:
I am trying to figure out how to create a report that will return orders current, over 30, over 60, over 90, and over 120. In one table I have Cust_Code, INV_Date, INV_Due_Date, INV_Bal and in...
9
by: Warren | last post by:
I am trying to create a report that does the following: Access Data in Query: NAME | DATE | SALE TYPE | ------------------------- John DOE | 1282003 | TYPE A Jane DOE | 1282003 | TYPE C...
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
1
by: Marie | last post by:
How do you display a total from a subreport on the main report. If it makes a difference, the total is a total of a calculated field (Qty * Price). Does the total on the subreport go in the...
1
by: Shelby | last post by:
Problem: My company generates its own data export from a propietary database. These (free) tables can be read in C#.NET using a Visual FoxPro driver (vfpoledb). I can read each of the six tables...
0
by: mariat101 | last post by:
I am collecting patient information when they do not show for an apt. I've created 4 tables linked by autonum b/c I have 3 of them in a form as subforms b/c they want to be able to see everything on...
2
by: Jana | last post by:
Using Access 97. Background: I have a main report called rptTrustHeader with a subreport rptTrustDetails in the Details section of the main report. The main report is grouped by MasterClientID. ...
5
by: apartain | last post by:
My database is based on Work Order Numbers. If an employee enters labor, they must include the WO Number for it. Equipment, subcontractors, per diem and materials all must also have a WO number. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.