473,587 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(SumOfQuant ity).
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 2196
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**********@y ahoo.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.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(SumOfQuant ity).
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 ("SumOfQuant ity 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**********@y ahoo.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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 ("SumOfQuant ity 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
1956
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 3,475 2 Smith 12,302 3 Smith 19,450 4 Jones 16,700
8
4102
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 stores the quarter name in txtmonthlabel (a date field) and the quarters totals in txtdomic (a number field) EG If the user enters March 2004 they...
2
1792
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 cTotal As bct FROM qryCbank1 UNION SELECT cTotal As bct FROM qryCbank2 UNION SELECT cTotal As bct FROM qryCbank3 UNION SELECT cTotal As bct FROM...
4
3391
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 during the month. I'd like to get the totals of the payments and of the charges for each client. When I run the following query, I get huge...
2
2698
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, intNumOfApproved As String Dim QDF As QueryDef Dim PARAM As Parameter
2
1788
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 able to run company wide (all agencies) or specific agencies. So I figured I evaulate in code what they want and pass an where clause based on...
9
4013
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 my fields. When I try to run it I get #errors in my RunTot column. I'm kinda new to this. Not sure if maybe I mistyped something wrong or is...
4
5648
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 (total 10 hours) and I have yet to resolve it. please excuse me for my lack of terminology, I will try to provide you with the best of information. ...
8
7160
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 week upgraded from Windows XP/Office 2003 to Vista x64/Office 2007. Under Access 2007, a couple of forms are now taking 60 seconds to
5
2323
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 -521,140.08 2006 -455,788.20 2006 -212,507.35
0
7843
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8205
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6619
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.