[AccessD] SQL Gurus - Running count.

Max Wanadoo max.wanadoo at gmail.com
Mon Jun 8 14:55:46 CDT 2009


Thanks Jim,
I think I will have to go that route.  Another problem I ran into was that I
wanted the report to sort on a field but I didn't want it to appear in the
report or group by it either.
Separate table will solve it all for me.
thanks

Max



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman
Sent: 08 June 2009 20:39
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




More information about the AccessD mailing list