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

Sum of Sum in Totals Query

I have a form based on a totals query, with one of the fields as the
sum of the quantity of an article of the grouped records. I get an
#error# in a control on the form where I want to display the sum of
this sum. TxtExample =sum(SumOfQuantity).
I understand that I can't sum a calculated control but I would argue
this is not a calculated control. I have been wrong before though....

Any help would be very much apprciated, thanks in advance

Dec 15 '05 #1
3 2188
You can sum the calculated query field.

From your description, it sounds like your text box has these properties:
Name txtExample
Control Source =Sum([SumOfQuantity])
Set its Format property to Currency or General Number so Access understands
the type.

If that still fails, temporarily try:
=[SumOfQuantity]
just to check that everything else is in order.

You might also typecast the expression in your query.
Switch the query to SQL View (View menu.)
Where you see:
Sum([Quantity]) AS SumOfQuantity
change it to:
CCur(Nz(Sum([Quantity]),0)) AS SumOfQuantity
For an explanation, see:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

Please post a reply if you are still stuck, as your approach should work.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Joost" <am**********@yahoo.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
I have a form based on a totals query, with one of the fields as the
sum of the quantity of an article of the grouped records. I get an
#error# in a control on the form where I want to display the sum of
this sum. TxtExample =sum(SumOfQuantity).
I understand that I can't sum a calculated control but I would argue
this is not a calculated control. I have been wrong before though....

Any help would be very much apprciated, thanks in advance

Dec 15 '05 #2
Thanks for taking the time Allen,

I set the Format properties; this didn't make any difference. I put the
control to =[SumOfQuantity] and that worked OK.
As you told me the approach should work, I created a new form based on
the query, and put a Control to =Sum([SumOfQuantity]) That worked
perfectly fine on this form....

So I went back to my original form and played around a little bit. One
thing I did was to change the underlying query and instead of SELECT
[QryName].* ,select all the underlying Fields of the Query
individually, among others the one the Control gave me the error on:
[QryName].SumOfCantidad.
That didn't make any difference either, but when I changed he name of
that field to an expression with the same name ("SumOfQuantity AS
SumOfQuantity") believe it or not, it worked, and from that moment on
everything worked perfectly, even going back to the situation that gave
me the trouble and made me post the message.
I know it sounds weird, but it's like Access understood what I wanted
from that moment on....it's like beyond the stage of "Artificial"
Intelligence......

Any explanation?? If not once again thanks for your insight. I have
read dozens of your contributions and they have helped me enormously...

Dec 16 '05 #3
Have you unchecked the boxes under:
Tools | Options | General | Name AutoCorrect
If not, you *really* need to do that. There are literally dozens of problems
with misassigned names that trace back to this misfeature. Here's just a
few:
http://allenbrowne.com/bug-03.html

Even with that Name AutoCorrupt disabled, I think I saw this issue once,
where changing the field from the default name solved the problem. I can't
remember, but I suspect there ended up being something else that was wrong
with that query as well, and so the change of name was really just masking
the true source of the problem.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Joost" <am**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Thanks for taking the time Allen,

I set the Format properties; this didn't make any difference. I put the
control to =[SumOfQuantity] and that worked OK.
As you told me the approach should work, I created a new form based on
the query, and put a Control to =Sum([SumOfQuantity]) That worked
perfectly fine on this form....

So I went back to my original form and played around a little bit. One
thing I did was to change the underlying query and instead of SELECT
[QryName].* ,select all the underlying Fields of the Query
individually, among others the one the Control gave me the error on:
[QryName].SumOfCantidad.
That didn't make any difference either, but when I changed he name of
that field to an expression with the same name ("SumOfQuantity AS
SumOfQuantity") believe it or not, it worked, and from that moment on
everything worked perfectly, even going back to the situation that gave
me the trouble and made me post the message.
I know it sounds weird, but it's like Access understood what I wanted
from that moment on....it's like beyond the stage of "Artificial"
Intelligence......

Any explanation?? If not once again thanks for your insight. I have
read dozens of your contributions and they have helped me enormously...

Dec 16 '05 #4

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

Similar topics

2
by: Deano | last post by:
OK, I'm working on a solution to the following problem but there are other ways to skin a cat as they say... Here's the table (simplified); ID EmployeeName SalaryAcc 1 Brown ...
8
by: Tony Williams | last post by:
I have a database that hold s figures for each quarter. I want to create a query whereby the user can ask for the running total of the data upto the quarter they enter into a prompt. The database...
2
by: deko | last post by:
I have a number of queries that pull totals from different tables. How do I sum the different total values from each query to get a grand total? I tried using a Union query like this: SELECT...
4
by: New Guy | last post by:
I'm trying to work with a system that somebody else built and I am confounded by the following problem: There is a table of payments and a table of charges. Each client has charges and payments...
2
by: BerkshireGuy | last post by:
I have the following code: Dim strSQL As String Dim DB As DAO.Database Dim RS As DAO.Recordset Dim intNumOfPaid, intNumOfHypoed, intNumOfNotTaken, intNumOfDeclined, intNumOfWasted,...
2
by: BerkshireGuy | last post by:
I have a form that acts like a dashboard to show summarized data. Currently, this form gets its summarized values from a total's query. When the user selects to run the dashboard, they should be...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
4
by: Micheal | last post by:
Greetings Access Group, Being relatively new to Access, I try to work through problems on my own and have been very successful, although I have a conundrum that I have been working on for two days...
8
by: elias.farah | last post by:
Hello Everyone, I'm having some very weird behavior on a couple of Access forms. (Not all forms, just some of them). The forms have been working for years, under Access XP/2003 etc, and last...
5
by: colin spalding | last post by:
How do I design a totals query that instead of the following result YearOfAcc PremiumGBP 2004 9,142,306.95 2004 1,481,153.21 2005 11,981,987.85 2006 20,653,195.20 2006 ...
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
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...
1
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.