473,756 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Total Query from Subtotal Query

Please help.

GOAL: I hope to calculate a total amount in a TotalQuery (or field in
the SubQuery?), based upon three field amounts in a SubQuery.

STATUS: When I create an expression in the TotalQuery based upon
SubQuery fields, e.g:

Total: [SOPAmount] + [PetFilingAmount] + [SummonsFilingAm ount]

'The resulting [Total] field displays each of the three SubQuery
amounts sequentially in the same field [156.00 50.00 5.00], rather than
the sum of having added them. However, when I test the expression
using multiplication (*) the [Total] field displays the correct total
amount. For example, the expression:

Total: ([SOPAmount]*[PetFilingAmount])+ [SummonsFilingAm ount]
'yields a correct single total amount, [7505.00].

The SubQuery in ms-access 2k sums the amounts from certain checks
entered for specific purposes. All resulting records from the Subquery
are sorted on a [MergeDate] field:

The Subquery SQL statement is as follows:

SELECT FormatCurrency( DSum("[Amount]","tblPaymentAc counting","[Purpose]
= 'Service of Process' "),2) AS SOPAmount,
FormatCurrency( DSum("[Amount]","tblPaymentAc counting","[Purpose] =
'Petition Filing Fees' "),2) AS PetFilingAmount ,
FormatCurrency( DSum("[Amount]","tblPaymentAc counting","[Purpose] =
'Summons Filing Fees' "),2) AS SummonsFilingAm ount
FROM tblDebtorMaster FileList
WHERE (((tblDebtorMas terFileList.Mer geDate)=#1/14/2005#));

I don't work with Access all the time, so I am not that astute at these
queries. Could someone please advise me on the best method to obtain a
TotalFees based upon the added total from the three field amounts in
the underlying query.

Nov 13 '05 #1
2 5646
I suspect your problem may be that the FormatCurrency has turned the fields into a text field by default, so that the + operator acts as a concantenation rather than an addition. In your total query, try explcitly converting them back into a number eg:

TotalFees: CDbl([SOPAmount]) + Cdbl([PetFilingAmount]) + CDbl([SummonsFilingAm ount])

(I think it's CDbl - it's whatever the equivalent of CInt and CStr are... CSng may be enough too).

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #2

David Seeto via AccessMonster.c om wrote:
I suspect your problem may be that the FormatCurrency has turned the fields into a text field by default, so that the + operator acts as a
concantenation rather than an addition. In your total query, try
explcitly converting them back into a number eg:
TotalFees: CDbl([SOPAmount]) + Cdbl([PetFilingAmount]) + CDbl([SummonsFilingAm ount])
(I think it's CDbl - it's whatever the equivalent of CInt and CStr are... CSng may be enough too).
--
Message posted via http://www.accessmonster.com


Yes, you were correct about the FormatCurrency conversion being the
problem. Your suggestion fixed the problem, and I appreciate your
response. Thanks.

Nov 13 '05 #3

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

Similar topics

5
4083
by: eric | last post by:
Hi,everyone: I have my xml data defined as xml data definition I: <?xml version="1.0"?> <parents> <parent> <id>1000</id>
7
2831
by: rick | last post by:
Can anyone help, I am try to create a simple form using a table, where a user can fill out quanty and price and have a total automatically calculated and inserted in another field. I stuck trying to figure out how expand this script to recalculate when rows are added or removed. My code so far. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
0
2380
by: aspbeg | last post by:
subtotal and total in a datagrid for any columns
1
2578
by: mesud | last post by:
helow i'm new but i wanna ask that i need the code to connect database access with vb and calculate total,subtotal,tax etc. and display it
2
2107
by: bobw2961 | last post by:
I have what I hope is a simple question for some of you. I have two fields. Quantity and Price. I enter a text box named SubTotal in the detail of the report and set the control source to =*. This works fine and I have all the correct values in the detail of the report. Now at the bottom of my report I want a total. I insert a text box in the report footer named Total and set the control source to =sum(). This does not work. I get...
5
3977
by: mebrabham | last post by:
Hello, I am trying to create a running subtotal in a query and then graph the running subtotal for each city group. The data looks like this in the table (for illustration): My City My Date Cumulative Sum Daily Sum DC 03-Apr-07 6 6 DC 04-Apr-07 20 14 DC 05-Apr-07 0 0 DC 06-Apr-07 24 4
7
1835
lee123
by: lee123 | last post by:
hey all, i have made a order form with all the works. in vb 6 and in this form i have been trying to get a total of the items that a customer would have ordered. to make things make sense i have in my order form ( qty, product,unit price, and a total) there are 12 rows of these text boxes (1-44) i believe, any way on the bottom of the order form there is a (subtotal,salestax,final total.) now the question is.....(and it probably a simple one i...
8
2159
by: KUTTAN | last post by:
i want to total of all 7th columns(in all rows) of my table my tables id is ctl00_ContentPlaceHolder1_Quote1_RadGdProductList_ctl01 The first row of the table is headings the following code works fine in IE7 But I am getting 'NaN' when i use Mozilla i found that
2
1944
by: murch.alexander | last post by:
Hi all, I have a query that uses a subquery to subtotal one of its fields. This part is working fine. The twist is that when I encounter certain values, I want to reset the subtotal to zero and continue on. So, it's possible that out of 100 records, I might reset the subtotal to zero 20 times. I can do this in a report but I need it in query form so I can run it automatically when users log in to let them know if the subtotal has
0
9462
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10046
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9886
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9857
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9722
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7259
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3817
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
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.