By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,207 Members | 1,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,207 IT Pros & Developers. It's quick & easy.

DSUM

P: n/a
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.DSum(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
Share this Question
Share on Google+
3 Replies


P: n/a
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.DSum(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

P: n/a
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.com> wrote in message
news:mh*****************@newsread2.news.pas.earthl ink.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.DSum(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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.