Question about DCount

Question about DCount

am 11.11.2007 15:26:59 von Susan Bricker

I have used DCount() to determine the number of records in a recordset.
Silly me ... I just noticed that DCount returns an INTEGER, which can
hold a maximum value of 32,767. What if the recordset recordcount
exceeds 32,767? Is there a different function that returns a LONG
datatype (which can hold a value upto 2,147,483,647)?

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Re: Question about DCount

am 11.11.2007 15:27:12 von Bob Quintal

Susan Bricker wrote in
news:47371132$0$491$815e3792@news.qwest.net:

> I have used DCount() to determine the number of records in a
> recordset. Silly me ... I just noticed that DCount returns an
> INTEGER, which can hold a maximum value of 32,767. What if the
> recordset recordcount exceeds 32,767? Is there a different
> function that returns a LONG datatype (which can hold a value upto
> 2,147,483,647)?
>
> Regards,
> SueB
>
> *** Sent via Developersdex http://www.developersdex.com ***

DCount formally returns a variant, which will automatically switch to
long integer when required. Try it and see.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Re: Question about DCount

am 11.11.2007 15:31:04 von Mike Gramelspacher

You might try this:

Dlookup("Count(*)","Your_Table")

On 11 Nov 2007 14:26:59 GMT, Susan Bricker wrote:

>I have used DCount() to determine the number of records in a recordset.
>Silly me ... I just noticed that DCount returns an INTEGER, which can
>hold a maximum value of 32,767. What if the recordset recordcount
>exceeds 32,767? Is there a different function that returns a LONG
>datatype (which can hold a value upto 2,147,483,647)?
>
>Regards,
>SueB
>
>*** Sent via Developersdex http://www.developersdex.com ***

Re: Question about DCount

am 11.11.2007 16:08:22 von Lye Fairfield

Susan Bricker wrote in news:47371132$0$491$815e3792
@news.qwest.net:

> I have used DCount() to determine the number of records in a recordset.
> Silly me ... I just noticed that DCount returns an INTEGER, which can
> hold a maximum value of 32,767. What if the recordset recordcount
> exceeds 32,767? Is there a different function that returns a LONG
> datatype (which can hold a value upto 2,147,483,647)?
>
> Regards,
> SueB
>
> *** Sent via Developersdex http://www.developersdex.com ***

Where did you notice this? Perhaps you used VarType or TypeName?
TTBOMK DCount which I never use, returns a Variant, and in my expereince, a
variant holding a long integer(long).

Debug.Print TypeName(DCount("*", "Employees", "LastName >= 'B'"))
' long


In versions of Access >=2000 I use

Debug.Print CurrentProject.Connection.Execute("SELECT Count(*) FROM
Employees WHERE LastName >= 'B'")(0)

which I believe is equivalent to:

Debug.Print DCount("*", "Employees", "LastName >= 'B'")

both return 8.

--
lyle fairfield

Re: Question about DCount

am 11.11.2007 17:10:06 von lyle

On Nov 11, 10:08 am, lyle fairfield wrote:

> TTBOMK DCount which I never use, returns a Variant, and in my expereince, a
> variant holding a long integer(long).

Now there's a stuuuuuuuuuuupid sentence!

Re: Question about DCount

am 15.11.2007 20:58:16 von Susan Bricker

Michael,

Thanks for the reply. I apologize for the delay in this response but I
have not been receiving notifications at my home email account that my
post was responded to. I'll look into using Dlookup(). Thanks, again.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Re: Question about DCount

am 15.11.2007 21:00:21 von Susan Bricker

Lyle,

I apologize for not responding to your reply earlier, but I never
received notifications (from Developerdex) that my post was responded
to.

As for where I saw that Dcount() returns an Integer ... I'm pretty sure
that I clicked on Help (while working with the VBA) and got the info
from the Online Help for Dcount(). I have A2003, I believe. I'll look
into your suggested solution. Thanks, again.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Re: Question about DCount

am 15.11.2007 21:02:19 von Susan Bricker

Bob,

Thanks for your reply. I have not been receiving notifications from
Developerdex that my post was responded to (the reason for my late reply
to you). I will look into Dcount() again. I'm pretty sure, however,
that I looked up the information in the Online Help provided by
Access2003 for Dcount(). Thanks, again.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Re: Question about DCount

am 21.11.2007 06:37:22 von Larry Linson

"SueB" wrote in message
news:473ca5cb$0$496$815e3792@news.qwest.net...
> Bob,
>
> Thanks for your reply. I have not been receiving notifications from
> Developerdex that my post was responded to (the reason for my late reply
> to you). I will look into Dcount() again. I'm pretty sure, however,
> that I looked up the information in the Online Help provided by
> Access2003 for Dcount(). Thanks, again.

If you post directly to the newsgroup, you won't face that kind of problem.
If your verizon.net address is valid, then you have access to a news-server
as part of your ISP subscription. Unsurprisingly, it is called
"news.verizon.net" and you can use Outlook Express, which is included with
Internet Explorer, to read and post. If you prefer, there are other
newsreaders, some free, some fee... and many opinions on which is "best".
IE is definitely "free", and though some think it far from best, it works
nicely enough for many of us.

Larry Linson
Microsoft Access MVP