Dcount...Again

R

Robert Sykes

Hello Ladies and Gents, I'm making a database to track members at a fitness
club, this is what I have as the control source for it:

=DCount("[memtype]","Members","[PayMeth]=5 OR [PayMeth]=6 OR [PayMeth]=7 OR
[PayMeth]=8 AND [memtype] = 1")

What I want it to do is count all the members that have a memtype value of 1
and a PayMeth value of 5 or 6 or 7 or 8.

What am I doing wrong?

THIA

--
Notice of Confidentiality:
This transmission contains information that may be confidential and that may
also be privileged. Unless you are the intended recipient of the message
(or authorized to receive it for the intended recipient), you may not copy,
forward, or otherwise use it, or disclose its contents to anyone else. If
you have received this transmission in error, please notify us immediately
and delete it from your system.
 
A

Allen Browne

You need brackets:
=DCount("[memtype]","Members","([PayMeth]=5 OR [PayMeth]=6 OR [PayMeth]=7 OR
[PayMeth]=8) AND [memtype] = 1")

The logic of:
a OR (b AND c)
is not the same as:
(a OR b) AND c

For your particular example, it may be easier to use:
=DCount("[memtype]","Members","([PayMeth] Between 5 And 8) AND
([memtype]=1)")
 
D

Duane Hookom

You should place ()s around the PayMeths.
=DCount("[memtype]","Members","([PayMeth]=5 OR [PayMeth]=6 OR [PayMeth]=7 OR
[PayMeth]=8) AND [memtype] = 1")
 

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

Counting on reports 2
Dealing with Null Value's 1
Silly Question 3
Blank Pages 2
Year in Query 2
Private and Confidential 1
Data validition error in append query 1
Subreport Page Header not showing 2

Top