Table resorts rows and throws off order of second column

G

Guest

When I compact my database prior to making a MDE, my primary table is
occasionally resorted. It seems to occur when I add or work with records in
the table. This throws off the order when my users open the form that feeds
from the table. The first column maintains the correct sort but rows are
resorted based on the second column. There can be duplicates in either
columns but not in both. I know I could have a query that resorts the table
correctly everytime the form reads the table but I must be missing something.
I do NOT want the columns sorted alphabetically. These two columns are both
text fields and are not indexed. This table does not have a primary key. I
appreciate any advise.
 
M

MacDermott

You need a primary key.
Since you say there can be duplicates in either column, but not in both, I'd
suggest creating your primary key from these two.
Your table will then always display ordered according to this key.
(Note, however, that there is no intrinsic sort in an Access table.)
 
J

John Vinson

When I compact my database prior to making a MDE, my primary table is
occasionally resorted. It seems to occur when I add or work with records in
the table. This throws off the order when my users open the form that feeds
from the table. The first column maintains the correct sort but rows are
resorted based on the second column. There can be duplicates in either
columns but not in both. I know I could have a query that resorts the table
correctly everytime the form reads the table but I must be missing something.
I do NOT want the columns sorted alphabetically. These two columns are both
text fields and are not indexed. This table does not have a primary key. I
appreciate any advise.

A table HAS NO ORDER. It's an unordered "bucket" of data. As McDermott
says, it will - usually - be *presented* in primary key order, but
depending on the form you're using for it, and the filters, you can't
reliably count on even that.

You must - no option! - use your Query with a sort specified, sorting
on one or more fields in the table. If there is no combination of
fields which maintain the correct sorting order, you must add one -
for instance, if you want the data sorted in the order in which it was
entered, use a Date/Time field defaulting to Now().

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top