[AccessD] Count of Records Returned by Query

Kaup, Chester Chester_Kaup at kindermorgan.com
Fri Feb 26 09:46:24 CST 2010


Thanks.
Works great.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Friday, February 26, 2010 8:34 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Count of Records Returned by Query

Since this is an Access query as opposed to a SQL Server query, it seems
you're doing way too much work. Why not just do this:

x = Nz(DCount("*", "yourQueryName", "yourCriteriaIfAny"))

Then if x = 0, do something or if not, do something else.

hth,
Arthur

On Fri, Feb 26, 2010 at 9:11 AM, Kaup, Chester <
Chester_Kaup at kindermorgan.com> wrote:

> I have a query that may or may not return any records. I need to count the
> number of records returned if there are some or 0 if there are no records. I
> have tried the following with no success..
>
> RA Inj Count: IIf(IsNull(Count(Nz([PID]))),0,Count(Nz([PID])))
> RA Inj Count: Nz(Count(Nz([PID])),0)
>
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list