Jac van den Broek said:
I'm new to Microsoft Access so I'd like to have a procedure on how to do
this.
In every record of my query I need the recordnumber. Recordnumber (First
record) = 1 and so on.
I don't need the autonumbering.
In a relational database, records are, by definition, "unordered". To order
the records, you use a Query and specify Sort sequence if using the Query
Builder grid, or add an ORDER BY clause if writing your own SQL without the
Query Builder. This being so, a record number (presumably assigned by when
the record is entered) might be misleading because you might look at an
Employees table in Name order, and I might look at the same table by Date of
Hire.
That said, if you are working in VBA Data Access Objects or ActiveX Data
Objects code, there is an .AbsolutePosition property of a Record -- showing,
you guessed it, the position of the Record in the current Recordset. It is
determined when you create the Recordset, so is not likely to be consistent
across retrievals, if the records are retrieved in different order each
time.
Larry Linson
Microsoft Access MVP