Solved

iif on a Dcount function

Posted on 2015-02-11
4
164 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DSum for Access 6 47
combine ShipTo and BillTo Address 3 23
Continuous form : Prefilled Data 7 21
Access 2003, sort table via code 5 9
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now