DSum in Query

C

Con Giacomini

I would like to learn the syntax to enter a DSum function within a query
where the criteria for the DSum is the ClientID field displayed in the query
grid, such as the following expression:

Sum("[Field]","
","[ClientID]=[This Query's ClientID]")

I would like the expression to produce the sum totals for each client in the
query.

Is this possible to do? Thanks for any help.
 
D

Duane Hookom

To use DSum(), try:
DSum("[Field]", "
", "[ClientID] = " & [ClientID])
This assumes ClientID is numeric. If it is text, then try:
DSum("[Field]", "
", "[ClientID] = """ & [ClientID] & """")
You could probably also use a subquery
(Select Sum([Field]) From
T Where T.ClientID =
.ClientID)
 
C

Con Giacomini

Thanks a lot Duane. It worked perfectly!

Duane Hookom said:
To use DSum(), try:
DSum("[Field]", "
", "[ClientID] = " & [ClientID])
This assumes ClientID is numeric. If it is text, then try:
DSum("[Field]", "
", "[ClientID] = """ & [ClientID] & """")
You could probably also use a subquery
(Select Sum([Field]) From
T Where T.ClientID =
.ClientID)


--
Duane Hookom
MS Access MVP


Con Giacomini said:
I would like to learn the syntax to enter a DSum function within a query
where the criteria for the DSum is the ClientID field displayed in the query
grid, such as the following expression:

Sum("[Field]","
","[ClientID]=[This Query's ClientID]")

I would like the expression to produce the sum totals for each client in the
query.

Is this possible to do? Thanks for any help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top