Solved

ADP Report Aggregate Function not allowed

Posted on 2008-10-09
6
1,027 Views
Last Modified: 2013-12-05
Thank you for looking at my question,

I have a working report in an Access database that groups data by Week, Date and Shift. I have tried to translate this same format to and Access ADP report but the aggregate functions that work in the access report don't work in the ADP report.

An example of one of the aggregate functions is:

=Sum(IIf([ShiftNo]=1,[JobCount],0)) - this is placed in the control source of a textbox in the report
counts the number of jobs started by Shift1 in a week

The error message I get is:
Aggregate functions are only allowed on output fields of the Record Source

I tried using a CASE statement:
=Sum(CASE WHEN [ShiftNo]=1,[JobCount])

but am told that the expression I have entered contains incorrect syntax.

How do I translate / re write the aggregate function such that it performs dynamic calculation in the adp report.

Thank you
0
Comment
Question by:Crxfrd
  • 4
  • 2
6 Comments
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 22677622
see http://support.microsoft.com/kb/225992

If the field where you want the calculation is not in the footer, then aggregate in the datasource of the report, o: return already calculated value:

select ..., case when shiftno=1 then jobcount else 0 end as Shift1Jobs, .....
0
 

Author Comment

by:Crxfrd
ID: 22677759
vadimrapp1:

I read that article and to me it suggested that i needed to carry out the calculation in the report footer and then refernce the container in the control source in the week footer. Still get the same error messages
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 22679541
the article says that in the detail section you put the field that calculates the value without the aggregation, and then in the footer you have a field that sums the field in the detail section.

detail ---------------------
field c1 with controlsource =iif(shiftno=1,jobcount,0)

footer --------------------
field c2 with controlsource =sum(c1)


if it still does not work, I suggest that you create a sample adp exactly as in the article, linked to some trivial table in the database; make sure it works, then see what's different with yours. If sample still does not work, you can upload it to this question.
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:Crxfrd
ID: 22684931
I have already tried that approach with the format =Sum([txtJobCount1]) and I get an invalid column name error.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 22688739
Please proceed to the last paragraph of my previous comment. Maybe remove the square brackets, to begin with.
0
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 500 total points
ID: 22690387
here's another way: make that new field in Detail section with running sum=yes; and the field in the footer - have it control source =<new field>
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

Suggested Solutions

Title # Comments Views Activity
ACCESS 2010 - VBA - generic Table Open Button - Code 7 25
Calculation in Access 5 29
SQL Group on First occurrence 9 27
Switch 5 20
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…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
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…

825 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