and-or

R

rob p

This is an unbound text box:
=DSum("Amount","tblquery23",("[StateTaxCode]='WI' and ([EarningCode]<>Null
or [DeductionCode]<>Null)"))

I want total if StateTaxCode=WI and NOTHING is in both EarningCode and
DeductionCode fields. The above gives the opposite of what I want - which I
could subtract from the sum of all WI amounts.

If I change formula "([EarningCode]=Null and [DeductionCode]=Null)" I get
nothing.Yet there are records with nothing in both the EC and DC fields that
I want to add up. What am I missing?

thanks.
 
K

Ken Snell

Null does not equal anything, ever...including Null. And I think you want
the "or" to be "and" for the last two checks.

Use this syntax instead:

=DSum("Amount","tblquery23",("[StateTaxCode]='WI' and ([EarningCode] Is Not
Null
And [DeductionCode] Is Not Null)"))
 

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