Solved

iif on a Dcount function

Posted on 2015-02-11
4
166 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
  • 2
4 Comments
 
LVL 47

Accepted Solution

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

or, if [Field] is numeric:

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

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 47

Expert Comment

by:Dale Fye (Access MVP)
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

770 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