Solved

ADP Report Aggregate Function not allowed

Posted on 2008-10-09
6
1,024 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

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

863 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

19 Experts available now in Live!

Get 1:1 Help Now