473,756 Members | 6,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DSUM

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 trying to do is create a subreport
for the main report which gives a generalised breakdown of the main report.

For the gender of 'Ladies', there may be several parea's so I want to sum
the packs_req for ladies only. (Gender is not a field I can use, it has to
be parea) I figured I could do this using DSUM by setting the criteria to
sum packs_req if the 'parea' meets certain criteria.

As I have never used DSUM before, I went into the help file but I cannot
make sense of it.

It says I need to use "expression.DSu m(Expr, Domain, Criteria)" giving an
example of:
Dim curX As Currency
curX = DSum ("[Orders]![Freight] ", "[Orders]", "[ShipCountry] = 'UK'")The
criteria bit I get but the rest means nothing to me. Could anyone shed any
light on this please?Many thanks, Mark
Nov 12 '05 #1
3 3766
Mark Reed wrote:
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 trying to do is create a subreport
for the main report which gives a generalised breakdown of the main report.

For the gender of 'Ladies', there may be several parea's so I want to sum
the packs_req for ladies only. (Gender is not a field I can use, it has to
be parea) I figured I could do this using DSUM by setting the criteria to
sum packs_req if the 'parea' meets certain criteria.

As I have never used DSUM before, I went into the help file but I cannot
make sense of it.

It says I need to use "expression.DSu m(Expr, Domain, Criteria)" giving an
example of:
Dim curX As Currency
curX = DSum ("[Orders]![Freight] ", "[Orders]", "[ShipCountry] = 'UK'")The
criteria bit I get but the rest means nothing to me. Could anyone shed any
light on this please?Many thanks, Mark

Freight = value to sum
Orders = Table/Query
ShipCountry = Filter. Similar to a WHere clause in SQL without the word
Where.

Before you get into sub-reports see if you can do this by summing the
values in a footer band. If you can sort/group in a manner where you
can simply get the totals in the footer/header, that would be easier.

Nov 12 '05 #2
Cheers Salad.
I got the query to work ok using Pack req: DSum("[example].[packs
req]","[example]","[p/area]='11'").

Could you explain what the expression at the start is please. "Dim curX As
Currency curX "

Cheers again,

Mark

"Salad" <oi*@vinegar.co m> wrote in message
news:mh******** *********@newsr ead2.news.pas.e arthlink.net...
Mark Reed wrote:
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 trying to do is create a subreport for the main report which gives a generalised breakdown of the main report.
For the gender of 'Ladies', there may be several parea's so I want to sum the packs_req for ladies only. (Gender is not a field I can use, it has to be parea) I figured I could do this using DSUM by setting the criteria to sum packs_req if the 'parea' meets certain criteria.

As I have never used DSUM before, I went into the help file but I cannot
make sense of it.

It says I need to use "expression.DSu m(Expr, Domain, Criteria)" giving an example of:
Dim curX As Currency
curX = DSum ("[Orders]![Freight] ", "[Orders]", "[ShipCountry] = 'UK'")The criteria bit I get but the rest means nothing to me. Could anyone shed any light on this please?Many thanks, Mark

Freight = value to sum
Orders = Table/Query
ShipCountry = Filter. Similar to a WHere clause in SQL without the word
Where.

Before you get into sub-reports see if you can do this by summing the
values in a footer band. If you can sort/group in a manner where you
can simply get the totals in the footer/header, that would be easier.

Nov 12 '05 #3
Mark Reed wrote:
Cheers Salad.
I got the query to work ok using Pack req: DSum("[example].[packs
req]","[example]","[p/area]='11'").

Could you explain what the expression at the start is please. "Dim curX As
Currency curX "


In your code you have
Dim curX As Currency

You are declaring a variable as a type of storage unit. You have
date/time, string, logical, various type of numerics; doubles, longs,
integers, etc, variant (accepts any type), etc.

Many programers use a "code", often called Hungarian code, to define a
variable. The code is usually 2 or 3 characters. str or st for string,
cu or cur for currency. This defines the type of variable to the
programmer. He/she knows what type of data is expected to be stored in
that variable. It could have been
Dim x As Currency
but if you look at the your code down several pages down the module, you
might not know what type of data is stored in X. I consider it good
coding practice to put in a prefix.
For your info, any unbound text fields on a form are type variant. That
is why you can store dates, numbers, logicals, strings to an unbound field.

Nov 12 '05 #4

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

Similar topics

0
3353
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. The DSum function relates to a subform (sfrmCost) with a text box (RefCost) which is intended to be the container for a total from a query (qryItems). The query has three number columns from the table (tblItems) of which I have an expression...
2
11593
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 background (Access 97) - the DSum expressions are being used in grand total text boxes on the footer of a subform. And when viewing the subform in the linked main form the two grand total boxes display #Error if no entry had been made. Those with...
1
4155
by: Alex | last post by:
Acc 97 Hi, I have the following in my query which works well if it is all set to numbers on table design. But what I want to do is where it states MC (short for machine name) use the actual machine name of which there are 5 off. therefore, on the table design I flick it over to text mode.
4
3013
by: John Baker | last post by:
Hi: I have a form, and wish to show on the form the current total for a single field on a table. I have set this up thus: =DSum(,!) in an unbound text field. These are correct field and table names. While the formulation is accepted by the system, nothing appears in the field and no results show up at all. I tried a number of combinations with no success. Can someone tell me what I am doing wrong? Thanks
3
2957
by: beppe005 | last post by:
I would like to calculate a total for all the field with the same in a query. I don't know how to set the "criteria" for this dsum function, it should be something like = but it doesn't make sense. The query is something like: +-- --- ---- ---- --- ---+ +--1-----Alpha-------a1----------------1------------4------------------+ +--1-----Alpha-------a2----------------3------------4------------------+
1
2175
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 expression:
33
8243
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 tblOrder (and a field in tblOrder) and the list of meals along with their costs are in the tblOrderDetail Subform (the columns in this form come fromt two tables - tblOrderDetails and tblItems). I have been putting the DSum / Sum in the control...
1
3865
by: danielgoss | last post by:
Hi I have a report that has loads of textboxes that calculate things based on the value on another textbox in the report. I have put a hidden textbox on my report that gets its value from an inputbox when the report opens. I then want to use the value inputted in a DSUM calculation on the same form. The hidden textbox is called tbHolddate, its control source is: =InputBox() The textbox that calculates a value using a DSUM control...
3
2075
by: majapa | last post by:
To start, here is my DSum expression: Develop: Nz(DSum(". & "] + . & "]","CSO","='Ability to Develop'")*-1,0) I actually have 4 of these, each one with a different option for . For more context, the . part is drawing from a separate reference table which cycles through plugging in the name for each DB_ and Ben_ field in the CSO table. What I want to do is add another layer of criteria, the field which exists in the same CSO table. I'd...
0
9454
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
9271
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8709
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7242
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
6533
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5139
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3804
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
3352
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2664
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.