Generating sequential numbers

  • Thread starter Thread starter Adam
  • Start date Start date
A

Adam

Is there any way I can use a query to sort a table and then, using an update
query, generate a sequential number based on the sort order I have chosen?
In other words, I sort the table by whatever method I choose, and then in
that sort order, a field in the table would have the value 1 for the first
record, 2 for the second, and so on.

This seems like a very simple thing to do, and I could no doubt write some
very simple VBA code to do it, but I can't help feeling I ought to be able
to do it with a query. Any ideas?

Many thanks
 
Hi,


With JET? Insert the sorted rows in a new table having a
(non-replicable, incrementing) AUTONUMBER field. Do not specify a value for
the autonumber field in your INSERT INTO statement, but be sure to include
the ORDER BY clause in the SELECT statement.

Hoping it may help
Vanderghast, Access MVP
 
Many thanks, that works a treat.

Adam

Michel Walsh said:
Hi,


With JET? Insert the sorted rows in a new table having a
(non-replicable, incrementing) AUTONUMBER field. Do not specify a value for
the autonumber field in your INSERT INTO statement, but be sure to include
the ORDER BY clause in the SELECT statement.

Hoping it may help
Vanderghast, Access MVP
 
Back
Top