dcount(multiple criteria)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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')")
 
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
 
Hi,

Sorry if this is posted in the wrong place but i couldn't help notice your knowledge on the DCount function.

I have a problem with using the DCount function in my MS Access DB, i have no trouble counting a look-up field with the drop down list only allowing one selection, the problem i have is when the look-up field has a drop down list that allows multiple values to be selected i.e a tick box next to each value in the list, i get the #Error message returned if you have an idea on what i may need to do to to my formula?

Thanks in advance

Chris
 
chris this is a 5.5year old thread you really dont expect help do you?:eek::rolleyes:
start a new thread if your still after help as this will help you better.:wave:
 
Back
Top