DSum multiple types of criteria

T

Tom Brown

I am trying to create a DSum value where 2 examples of the same criteria are
part of the function
Ex:
=nz(DSum("Amount","tbl_NUS1","TaxType=""" & "rcls" & """ or TaxType= """ &
"wo" & """ PLPCTR=""" & "P220703" & """
and [PdYr] > #12/31/2005# and [PdYr] < #1/1/2007# "),0)

I am trying to have the DSum total the amount from tbl_NUS1 of both TaxType
"wo" and/or "rcls". I want a total if one
or both of them exist. When I enter one or the other by themselves I get the
correct amount, when I use both I either get an error
or an amount way off the actual total of the two. Please can someone tell
me the correct syntax.


Thanks for your help.


Tom
 
D

Duane Hookom

Try:
=nz(DSum("Amount","tbl_NUS1", "(TaxType='rcls' or TaxType= 'wo') AND
PLPCTR= 'P220703' and PdYr > #12/31/2005# and PdYr < #1/1/2007#"),0)
 
T

Tom Brown

Sorry, but I was just now able to try out your solution, and it worked
great.
Thanks!

Duane Hookom said:
Try:
=nz(DSum("Amount","tbl_NUS1", "(TaxType='rcls' or TaxType= 'wo') AND
PLPCTR= 'P220703' and PdYr > #12/31/2005# and PdYr < #1/1/2007#"),0)

--
Duane Hookom
MS Access MVP

Tom Brown said:
I am trying to create a DSum value where 2 examples of the same criteria
are
part of the function
Ex:
=nz(DSum("Amount","tbl_NUS1","TaxType=""" & "rcls" & """ or TaxType= """ &
"wo" & """ PLPCTR=""" & "P220703" & """
and [PdYr] > #12/31/2005# and [PdYr] < #1/1/2007# "),0)

I am trying to have the DSum total the amount from tbl_NUS1 of both
TaxType
"wo" and/or "rcls". I want a total if one
or both of them exist. When I enter one or the other by themselves I get
the
correct amount, when I use both I either get an error
or an amount way off the actual total of the two. Please can someone tell
me the correct syntax.


Thanks for your help.


Tom
 

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

Top