Insert a recordnumber

  • Thread starter Thread starter Jac van den Broek
  • Start date Start date
J

Jac van den Broek

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.

Thanks

Jac
 
There is no inherent "record number" for records in your tables. Records
are stored unsorted, though typically in data entry order. You could add a
number field to your table and do a short routine on your data entry form to
enter a serialized number. Or you could add a date/time field and capture
the exact date/time of data entry, then sort your records in date/time
order.
-Ed
 
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
 
Back
Top