Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autonumeric field and the table order 1

Status
Not open for further replies.

ricardo1023

Programmer
Mar 23, 2008
54
US
I do have a large collection of data in a table. I do want to create an autonumeric field to keep the order of the table when exporting (by sorting by that field on the query). The problem is that after creating the autonumeric field (using increment) Access generates the numbers on the new column (the autonumeric one) out of order! What do determine in which order the autonumeric values are generated (I was expecting to have the values 1,2,3.... in the same order as the data on the table is). Any help will be appreciated
 
the same order as the data on the table is
There is no peculiar order of data in a table !

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Access is relational, and relations don't have any order. You must ensure that any ordering you need is provided by data values. (This is a principle of the Relational Model ie that meaning is not hidden by such means as order).If you find this difficult, Access will, other things being equal, number things in rising order when you load a table. If you can think of a way of getting your data into the right order (a query?) you can load a table afresh from this query (or whatever) and the autonumber will be correct. Of course, that rather suggests you don't need the autonumber because you can always create the right view from the query, but often it is convenient to use an autonumber ( as an alias in Ted Codd's terminology.) If you make the autonumber the primary key then Access will always present the data in autonumber order.

This is part of another problem - people should really always access tables via a view (a query in Access). If you can't think of a view that gives you the right 'order' you are not creating a reliable data model.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top