how do I autonumber rows in an access query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking for a way to number the rows in a query result.
Example:

Row1 Row2
A B
C D
E F

Needed

Row1 Row2 NumberedRow
A B 1
C D 2
E F 3
Etc.

I am a fairly new user and not a probrammer.
 
In a Report, it's relatively simple. Just create a textbox with a Control
Source of =1 and set the Running Sum property to either Over Group or Over
All.

If you actually need it in a Query, it's more complicated. There are two
methods, one using DCount() and another using a subquery. In this case, a
sample may be worth a thousand words, so on my website
(www.rogersaccesslibrary.com), is a small Access database sample called
"NumberedQuery.mdb" which illustrates both of these methods.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
This appears to return the sequence in the table but not the numbering i.e.
1,2,3,4 that I am looking for. Here is the code I substituted:

Sequence: (Select Count(1) FROM Rooster A
WHERE A.EMP_ID <=Rooster.EMP_ID)

The table has about 700 records and I am filtering about 40 of them.

Any suggestions???

Thanks,
David M
 
Back
Top