dcount(multiple criteria)

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
 
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')")
 
G

Guest

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
 
Joined
Feb 28, 2011
Messages
1
Reaction score
0
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
 
Joined
Jan 14, 2006
Messages
12,268
Reaction score
283
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:
 

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

Access Dcount (multiple criteria) 3
DCount alwaysreturning 1 0
Access MS Access DCount function problem 0
DCOUNT with 2 Criteria 3
DCount 2
dcount() query 1
Dcount returning no results!!! 0
Counting yearly totals 5

Top