[AccessD] SQL Gurus - Running count.

Jim Dettman jimdettman at verizon.net
Mon Jun 8 14:38:42 CDT 2009


  BTW, there is a faster method, but it's uses are limited (make tables and
as the basis for a report).  It however is a heck of a lot faster then the
sub-query method

Jim.

Define a column as: 

  RowNum:GetLineCounter([<somefield])

Function:

Global glngGetLineCounter As Long

Function GetLineCounter(varName As Variant) As Long

  glngGetLineCounter = glngGetLineCounter + 1
  GetLineCounter = glngGetLineCounter

End Function 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Monday, June 08, 2009 3:09 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] SQL Gurus - Running count.

Any takers please?

Max



-----Original Message-----
From: Max Wanadoo [mailto:max.wanadoo at gmail.com] 
Sent: 08 June 2009 19:14
To: 'Access Developers discussion and problem solving'
Subject: SQL Gurus - Running count.

Hi Guys,

With a select statement, how do I get a running count matching the rows
return.
Starting at 1 and incrementing by 1 for each row.
The final count to be equal to the number of rows returned.
The count to be part of the query.

I also want a second Count but this time not incremented.  Just a 1 in a
column for each row returned.

Thanks

Max



-- 
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