The query needs to be ordered. Here's a simple example of a query ordered by
date based on a table with columns YourDate (non-unique values) and YourID
(unique primary key column):
SELECT YourDate, YourID,
(SELECT COUNT(*)
FROM YourTable AS T2
WHERE T2.YourDate <= T1.YourDate
AND ( T2.YourID <= T1.YourID
OR T2.YourDate <> T1.YourDate)) AS [Counter]
FROM YourTable AS T1
ORDER BY YourDate, YourID;
If a query is being used as the RecordSource for a report you can very
easily number the rows in the report by including an unbound text box in the
detail section with a ControlSource of =1 and a RunningSum property set to
'Over All'. The way in which the rows are ordered is immaterial in this case.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.