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

Dsum Function. What is wrong with my expression?

I have a form in datasheet view with Total and Currency text boxes, in Currency text box I only can enter values of AZN and USD.
Form is based on Table and as criterias information fromUnbound control from another form is used,
In form footer I need to create too text boxes, one of then shoul calculate sum of Total for records where currency field equals to USD and other one calculates sum for Total for records where Currency field equals to AZN. I tried to use SQL in data source property for those fields. I faild, then try to calculate using DSUM function.

Here is my expression. What is wrong? in form view i see #Error as a result.

=DSum("[frmInvoicesResult]![Total]","frmInvoicesResult","[frmInvoicesResult]![Currency] = 'USD'")

Thanks in advance

Ambi :))
Nov 13 '08 #1
2 3342
Stewart Ross
2,545 Expert Mod 2GB
Hi. Sorry, but you can't achieve this using DSum the way you are trying to do. DSum sums fields in the specified table or query. It does not sum unbound textboxes - that is not its purpose. The help file data available off-line and on-line as part of Office Pro will guide you how to use DSum.

Your table/query reference is also in error - you are supplying the name of your form in place of a valid table or query.

And finally you are also supplying a similarly incorrect form control reference in the Where clause.

The #Error you are seeing results from Access not being able to recognise any of the things you tell it to do - the field to be summed, the table you want to sum within, and the Where clause are all incorrect.

As you have criteria involved you will either need to use DSum correctly, specifying the relevant field from the underlying table you want to sum and supplying a suitable where clause to restrict your results, or you will need to reconsider entirely the values you are including in your underlying query so that the sum of the relevant fields can be done in the report itself.

-Stewart
Nov 13 '08 #2
Thank You Very Much, Stewart!

So as I understood the problem is that the form is not the date source, but just ... form))


Because this one works properly))

=DSum("[QryPriceStatistics]![Price]","QryPriceStatistics","[QryPriceStatistics]![Status] = 'Recommended'")

Thanks again, will try another way.

Ambi :))
Nov 13 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Rolan | last post by:
I'm using Access 97 and need some assistance in sorting out a proper DSum expression, or maybe even DCount might be an alternative. I have tried numerous combinations, but with no apparent success....
1
by: Dalan | last post by:
I have tried both methods of using DSum and creating a Function to address summing some number columns, but to no avail. Since this has been a popular topic over the years, I'm sure I'll receive...
2
by: Dalan | last post by:
I seemed to be having problems with structuring the use of NZ with a DSum expression. Having tried numerous variations of the expression without success, I'm asking for assistance. First some...
3
by: Mark Reed | last post by:
All, I have never used this function before and am not sure it what I need. Just to clarify, I have a report based on a query which has amoungst other field, wk, parea & packs_req. What I am...
1
by: gbb0330 | last post by:
Hi All i am trying to calculate Quantity on hand in a unbound textbox in a form with a subform QonHand=Qreceived - TotalQSold TotalQsold=QsoldOnEbay+QsoldThruOtherChannels here is my...
8
by: deercreek | last post by:
I have the following table test3. RESERVATIONID Site SitePrice 101 RV2 $25.00 101 RV3 $25.00 102 RV4 $25.00 102 RV5 $25.00 104 ...
33
by: potassium flower | last post by:
I am trying to create a food order system for a restaurant. I have tried using both the DSum and Sum functions to calculate the total cost of an order. The total cost is a textbox on the form...
3
patjones
by: patjones | last post by:
Good morning all: In what seems like an ongoing saga to make the DSum function do what I need it to, I am now having trouble with a user-defined function in my VBA module. Here's the offending...
7
by: Lewe22 | last post by:
I have a query pulling information from multiple tables, one of which contains a list of students with an auto number their assessment information and how long the assessment took in minutes . ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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...
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...

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.