Solved Table Not Sorting Correctly (1 Viewer)

Weekleyba

Registered User.
Local time
Today, 18:50
Joined
Oct 10, 2013
Messages
586
I have a table that is used in a database that does not seem to sort correctly for one particular data number in the a field.
I'm puzzled on this one.
See below. I've sorted for only ContractID: 147. Note both the ContractLineItemID and LineItemNum do not sort Ascending.
I've check other ones, and they all see to sort correctly.
This is an issue as it is the record source for a subform and now #6 line item shows up first.
Any thoughts on what this is happening?
1647986272581.png
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 19:50
Joined
May 21, 2018
Messages
8,463
There is no reason that it should, unless you add those fields to the sort. You can You sorted by ContractID and it sorted correctly. You would need a query to specify to Sort by ContractID, Then by ContractLineItemID, then by LineItemNum.
You should not be manipulating a table anyways. You should work through queries and forms.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 16:50
Joined
Oct 29, 2018
Messages
21,358
I have a table that is used in a database that does not seem to sort correctly for one particular data number in the a field.
I'm puzzled on this one.
See below. I've sorted for only ContractID: 147. Note both the ContractLineItemID and LineItemNum do not sort Ascending.
I've check other ones, and they all see to sort correctly.
This is an issue as it is the record source for a subform and now #6 line item shows up first.
Any thoughts on what this is happening?
View attachment 99343
If you only sort on one column, you only get one sort order. To get multiple sort order, apply sorting on multiple columns.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 18:50
Joined
Feb 28, 2001
Messages
27,001
You should understand first and foremost that tables do not hold their sort order because of the potential for random record updates and insertions that have the effect of shuffling the table. Never expect a table to stay sorted. Always use a QUERY to do the ordering you need. You can query the whole table and just put ORDER BY clauses in place to force the correct sort order.
 

Weekleyba

Registered User.
Local time
Today, 18:50
Joined
Oct 10, 2013
Messages
586
Thanks guys for all the responses. I think this was either a user issue (maybe deleting and re-entering data) or a glitch somewhere.
I deleted the seven entries and inputted them back in and all is well.
I choose to do this after spot checking a half dozen of other records in the same table, and they we all correct.
I believe the problem is solved.
Thanks again.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 18:50
Joined
Feb 28, 2001
Messages
27,001
From your response it is not clear if the message got through. If users entered bad data, then that might indeed cause difficulties in ordering things. But if your action was to attempt to put data back into a table in a specific order, that is almost doomed to failure because tables do not hold order well - if at all. Not trying to be a hard case here, but I need to be sure the message got through. You cannot, long-term, rely on table order to remain fixed, even if you WEREN'T updating the table's primary key. ANY update can result in a table's apparent order getting shuffled. That is why you must use queries with ORDER BY - or use a form's ORDER BY property, which has the same effect.
 

Users who are viewing this thread

Top Bottom