Question : Incrementing a field in a query

anyone know how to increment a field in a query. i just need a field that counts starting from 1. so if i have 10 records in my recordset, i get values starting at 1 for the first record and i should have a 10 showing in the field for the 10th record in the query.

Answer : Incrementing a field in a query

You could use a global varable, something like this in a module:

Public nCount as Integer

public function counter() as integer

     nCount = nCount + 1
     counter = nCount
end function

public sub runQuery()

     nCount = 0
     DoCmd.openquery "qryTest"
end sub


where qryTest in something like

select counter(), ,
from
Random Solutions  
 
programming4us programming4us