dcount(multiple criteria)

D

dchristo

I need to find the number of of requests for several states, I am using the
following:

=DCount("[Request] ","Table Query","[State] ='NC' AND 'SC' ")

But it only picks up the First State i.e. NC

Can someone tell me what I am doing wrong.

Thank you
 
D

Douglas J. Steele

Well, first of all it's not possible for a field to have 2 values, so that
needs to be OR, not AND.

Second, you need to either repeat the field name for each condition:

=DCount("[Request] ","Table Query","[State] ='NC' Or [State] = 'SC' ")

or else use the In operator:

=DCount("[Request] ","Table Query","[State] In ('NC', 'SC')")
 
D

dchristo

Thank you very much

Douglas J. Steele said:
Well, first of all it's not possible for a field to have 2 values, so that
needs to be OR, not AND.

Second, you need to either repeat the field name for each condition:

=DCount("[Request] ","Table Query","[State] ='NC' Or [State] = 'SC' ")

or else use the In operator:

=DCount("[Request] ","Table Query","[State] In ('NC', 'SC')")



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


dchristo said:
I need to find the number of of requests for several states, I am using the
following:

=DCount("[Request] ","Table Query","[State] ='NC' AND 'SC' ")

But it only picks up the First State i.e. NC

Can someone tell me what I am doing wrong.

Thank you
 
Top