?
Solved

iif on a Dcount function

Posted on 2015-02-11
4
Medium Priority
?
189 Views
Last Modified: 2015-02-11
Hello I have the following and trying to figure out how to do an iif  statement

=DCOUNT ("Date","qry")

I want to say iif a field says "30551" then DCount

Thanks
0
Comment
Question by:Ernest Grogg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 40604151
=DCOUNT("Date", "qry", "[Field] = '30551'")

or, if [Field] is numeric:

=DCOUNT("Date", "qry", "[Field] = 30551")
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 40604174
Or maybe:

=IsNull(DCOUNT("Date", "qry", "[Field] = 30551"),0)   ' [Field] is numeric

=IsNull(DCOUNT("Date", "qry", "[Field] = '30551'"),0)   ' [Field] is string

Using the solution above.
0
 

Author Closing Comment

by:Ernest Grogg
ID: 40604194
Awesome!  


Thanks!
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 40604246
@eghtebas,

You don't need to use the NZ() function (IsNull is the SQL Server equivalent) with DCOUNT( ) because it will always return a value, unlike DLOOKUP( ) which could return a NULL and therefore need the NZ( ) function wrapper.

Dale
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question