Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

iif on a Dcount function

Posted on 2015-02-11
4
Medium Priority
?
192 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

598 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