DCount Function
Author Message
DCount Function

Quote:
>I have a datacontrol that returns data pretty quickly however in order
>to get the count of records it seems I need to use a MOVELAST and then
>check the recordcount.  Well, I thought that using the Domain
>Aggregate function DCount

Unless you absolutely need to have the count of records, your better off
not doing it. When your dealing with small tables, it's not so bad, but if
your tables get to the point where they have several thousand records in
them, getting a recordcount in ANY  way will slow things down.

Fri, 03 Oct 1997 03:00:00 GMT
DCount Function
I have a datacontrol that returns data pretty quickly however in order
to get the count of records it seems I need to use a MOVELAST and then
check the recordcount.  Well, I thought that using the Domain
Aggregate function DCount might be faster, however VB tells me it is
undefined.  Does anyone know how I can use it...does anyone know what
the Declare Function statement is for this function?  Thanks in

Ken

--
-------------------------------------------------------------------------------
Kenneth N. Sable - University of Pennsylvania
Computer Science and Engineering

Fri, 03 Oct 1997 03:00:00 GMT
DCount Function

Quote:

>Subject: DCount Function
>Date: 17 Apr 1995 02:17:33 GMT
>I have a datacontrol that returns data pretty quickly however in order
>to get the count of records it seems I need to use a MOVELAST and then
>check the recordcount.  Well, I thought that using the Domain
>Aggregate function DCount might be faster, however VB tells me it is
>undefined.  Does anyone know how I can use it...does anyone know what
>the Declare Function statement is for this function?  Thanks in

Hi Ken
From on-line help on DCount.

DCount Function Example

This example returns the number of large orders shipped to the United
Kingdom.  The domain is an Orders table.  The criteria argument restricts the
data by making the expression apply only to records in which Ship Country
equals UK and Order Amount is greater than 1000.

X = DCount("[Order Amount]", "Orders", "[Ship Country] = 'UK' And [Order Amount] > 1000")

------------------------------------------------------------------------
Chuck Stuart - Mesquite TX USA
VBTrace 2.00 is a runtime Procedure Trace, XRef,
Debug, Profiler and much more. Shareware \$49.
http://www.apexsc.com/vb/ftp/coop/cstuart
ftp.apexsc.com/pub/cgvb/coop/cstuart
------------------------------------------------------------------------

Fri, 03 Oct 1997 03:00:00 GMT
DCount Function

from [17.04.95]

Quote:
> check the recordcount.  Well, I thought that using the Domain
> Aggregate function DCount might be faster, however VB tells me it is
> undefined.  Does anyone know how I can use it...does anyone know what

hi dude.

Sorry, but this function can, vb-help according, only be passed in an sql-
statement...try using a SELECT-statement as your RecordSource-property,
which includes all the fields you handle with the data-control and
an example would be:
your_datacontrol.RecordSource=SELECT fielda, fieldb, fieldc,
DCOUNT('*','your_table') FROM your_table;

However on msaccess-basic, this function works, but in my opinion it seems
to be very slow.
bye ...
--

Wredestr. 4a     -------------------------------
97082 Wuerzburg  You may hate WIN, I may say its
+49-931/451465   just an easy way to earn money.

Sun, 05 Oct 1997 03:00:00 GMT
DCount Function

Quote:

>> check the recordcount.  Well, I thought that using the Domain
>> Aggregate function DCount might be faster, however VB tells me it is
>> undefined.  Does anyone know how I can use it...does anyone know what
>Sorry, but this function can, vb-help according, only be passed in an sql-
>statement...try using a SELECT-statement as your RecordSource-property,
>which includes all the fields you handle with the data-control and
>an example would be:
> your_datacontrol.RecordSource=SELECT fielda, fieldb, fieldc,
>                               DCOUNT('*','your_table') FROM your_table;
>However on msaccess-basic, this function works, but in my opinion it seems
>to be very slow.

Yes, it _is_ unclear using VB help how to use aggregate functions from VB.
I do it in the following way:

ssTemp = dbMyDB.CreateSnapshot("SELECT MAX(some_column) AS ColName
FROM MyTable")
MaxValue = ssTemp("ColName")

It _is_ fast for me.

Andrzej

Wed, 08 Oct 1997 03:00:00 GMT

 Page 1 of 1 [ 5 post ]

Relevant Pages