Charlotte Foust
cfoust at infostatsystems.com
Mon Jun 8 14:49:56 CDT 2009
As I recall, the main problem with that approach was that you have to remember to initialize glngGetLineCounter to zero each time before you run the query. Otherwise, the counts just keep climbing. Charlotte Foust -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman Sent: Monday, June 08, 2009 12:39 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] SQL Gurus - Running count. 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com