473,416 Members | 1,488 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,416 software developers and data experts.

Sort Report on Calculated Field

I've been given a database and asked to figure out how to sort a
report. The report needs to be sorted on a field that is the sum of a
field that is calculated in the underlying query. NetSales is
calculated in the query; the control source of the text box on the
report is Sum([NetSales]). I need to sort on this. I tried going to
the query and creating a new field - TotalNetSales: Sum([NetSales]),
but I get an error message about "cannot have aggregate function
in...clause (Sum([NetSales])". Is there a way to do this?

TIA,
JD
Nov 12 '05 #1
3 8487
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Not sure about this, but, in the report's (design view)
Grouping/Sorting dialog box put this in one of the Expression fields:

=Sum(NetSales)

& set its Sorting field to Ascending or Descending.
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQEZacoechKqOuFEgEQJcxwCZAZlakYljpT9QR69gvsedd1/ZhYwAn0uL
Fq52d4OvCrqI3MsOjHAXXZQn
=8m/p
-----END PGP SIGNATURE-----
jd****@yahoo.com wrote:
I've been given a database and asked to figure out how to sort a
report. The report needs to be sorted on a field that is the sum of a
field that is calculated in the underlying query. NetSales is
calculated in the query; the control source of the text box on the
report is Sum([NetSales]). I need to sort on this. I tried going to
the query and creating a new field - TotalNetSales: Sum([NetSales]),
but I get an error message about "cannot have aggregate function
in...clause (Sum([NetSales])". Is there a way to do this?


Nov 12 '05 #2
Thanks for the reply, but when I tried this, I got an error message:
"Cannot have aggregate function in ORDER BY clause (Sum([NetSales])."
Any other suggestions?

MGFoster <me@privacy.com> wrote in message news:<GT*******************@newsread2.news.pas.ear thlink.net>...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Not sure about this, but, in the report's (design view)
Grouping/Sorting dialog box put this in one of the Expression fields:

=Sum(NetSales)

& set its Sorting field to Ascending or Descending.
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQEZacoechKqOuFEgEQJcxwCZAZlakYljpT9QR69gvsedd1/ZhYwAn0uL
Fq52d4OvCrqI3MsOjHAXXZQn
=8m/p
-----END PGP SIGNATURE-----

Nov 12 '05 #3
You can always compute the sum (and fill all other fields) in one
query, then use it as the source query for another one that runs the
report, sorting by the sum field.

On 4 Mar 2004 06:13:51 -0800, jd****@yahoo.com (jd****@yahoo.com)
wrote:
Thanks for the reply, but when I tried this, I got an error message:
"Cannot have aggregate function in ORDER BY clause (Sum([NetSales])."
Any other suggestions?

MGFoster <me@privacy.com> wrote in message news:<GT*******************@newsread2.news.pas.ear thlink.net>...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Not sure about this, but, in the report's (design view)
Grouping/Sorting dialog box put this in one of the Expression fields:

=Sum(NetSales)

& set its Sorting field to Ascending or Descending.
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQEZacoechKqOuFEgEQJcxwCZAZlakYljpT9QR69gvsedd1/ZhYwAn0uL
Fq52d4OvCrqI3MsOjHAXXZQn
=8m/p
-----END PGP SIGNATURE-----


Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steven Stewart | last post by:
Hi there, I have a text box on a report that displays a "Team" name. Although, in the database, it is important for the team to be stored with three different titles (S&F West, S&F East, S&F...
7
by: Jacob Barnett | last post by:
Access 2000 main report does not display subreport data in preview and may or may not print... sometimes. Usually, the entire report is fine. The behavior does not seem to depend on particular...
2
by: Norma | last post by:
I have a table with a UPC#, CasesCompleted, TotalHours, standardGoal (pieces per hour) I am generating a report that groups by UPC and figures out production goals. In the Detail section of each...
6
by: DS | last post by:
How do you get a sumon a calculated field in a detail section on a report? I have a group footer that I need the sum on. Thanks DS
1
by: shobhit_shanker | last post by:
Here are the relevant "givens" to my problem... Form: frmLaunchRpt - Text Box: txtAsOfDate - Check Box: chkLogEval - Command Button: cmdLaunchRpt Report: rptEvaluation - Text Box:...
4
by: Marie | last post by:
My report has a text field named ItemNum. Most records have a value for ItemNum. I set Grouping And Sorting to sort ascending on the ItemNum field. The records where ItemNum is Null appear at the...
6
by: Julian | last post by:
Hi, I am a very beginner in databases. I created a database table in Access 2003 and OOo 2.03 that includes name, address, postcode, phone numbers etc of our customers. I would like to sort...
3
by: kelley.l.turner | last post by:
Hi all, I am very new to MS Access so please bear with me! I have created a simple calculated field in my data entry form, yet when I view my data table or try to generate a report based on...
1
by: Nelly | last post by:
Please help! I am trying to sort a query by a field calculated as e.g. / I keep getting an error about subqueries not allowed for this type of expression, but only when I set to sort. I...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.