Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thank you. I have never said it, but you have a great web site. It is of immense help...."

Geography

Where in the world do Tek-Tips members come from?

DCount, how do I have multiple conditions

Triacona (TechnicalUser)
5 Jul 12 9:38
Dear All,

I have a problem, I have a report which runs off a few queries.

Instead of creating 14 more queries I thought to use the DCount Function to enable me to use the queries to the best of my ability.
That worked fine when I used:

CODE

=DCount("REFVAL","SrNoiseCmplCount","[SRNOICAT]='INDUST'") 
The above worked fine when I only had to look for catefories.

I then needed to count via categories and outcomes.

This opened a can of worms, because I can have categories without outcomes.

I tried the DCount function as below and it gave me an #Error

CODE

=DCount("REFVAL","SrNoiseOutCome","IIf([SRNOIOUT]='NUICEA',IIf([SRNOICAT]='INDUST'),0)") 
How do I use DCount to set multiple criteria?

Thank you for your forthcoming help smile

Thank you,

Kind regards

Triacona

Triacona (TechnicalUser)
5 Jul 12 10:23
Hi,
I looked in the help file and found an example that helped and I used it in my problem...

But it gives the total number in the query 168 rather that 0 which is what this would give if you entered the criteria in the query

CODE

=DCount("REFVAL","SrNoiseOutCome","[SRNOIOUT]='NUICEA'" And "[SRNOICAT]='INDUST'") 

Any help would be greatly appreciatedbigsmile

Thank you,

Kind regards

Triacona

Triacona (TechnicalUser)
5 Jul 12 11:32
I have figured it out yay!

The CORRECT CODE is below.

CODE

=DCount("REFVAL","SrNoiseOutCome","[SRNOICAT]='INDUST' And [SRNOIOUT]='NUICEA'") 

INCORRECT CODE:

CODE

DCount("REFVAL","SrNoiseOutCome","[SRNOIOUT]='INDUST'" And "[SRNOICAT]='NUICEA'") 
YAY! bigsmile

Thank you,

Kind regards

Triacona

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close