Creating a numbered list based on query results return

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

Guest

I have a query. Each time I run it I get results....my question
is how do I progam an newly inserted column to number them
each time
For example
I run my query. I get 360 results...
I insert a column ...but don't know how to get it
to number them in the new column from 1-360.
 
KenRamoska said:
I have a query. Each time I run it I get results....my question
is how do I progam an newly inserted column to number them
each time
For example
I run my query. I get 360 results...
I insert a column ...but don't know how to get it
to number them in the new column from 1-360.


That kind of number is usually pretty useless unless you're
displaying the number in a report. If it will be displayed
in a report, then it's better to use a report mechanism
(RunningSum text box) to do it instead of doing it in a
query.

If you really do need it in the query then you can use a
subquery to calculate it. As long as there is a unique
field in the table to sort the records, the query would look
like:

SELECT table.*,
(SELECT Count(*)
FROM table AS T
WHERE T.sortfield >= table.sortfield
) AS number
FROM table
ORDER BY sortfield
 
Hi Marshall.
I do not have unique fields. They are all repeated.

Can you give me more info about the report answer?
I am not familiar with running sum report mechanisms.
Ken
 
If you don't have a way to sort the records, how can they be
numbered in a meaningful way?

To number the details in a report (in whatever order they're
displayed), just add a text box with the expression =1 and
set its RunningSum property to Over All .
 
Back
Top