sorting tables

C

collette

I am trying to sort a table using customer name, address, City and state
using ascending, while at the same time sorting date by descending. It is a
table of correspondence from various customers. I know it can be done, just
not how to do it. I know how to sort by one column ascending or descending,
but that is as far as I can get.
 
P

Philippe Perrault

Hi Collette,

Try creating a query. Show the table you need to sort in design view. Drag
each of the field names down to the grid. The first row will contain the
name of the field the second row the name of the Table the field belongs and
the third row is sorting. Us the pull down to select Ascending or
Descending. Then click the the Red exclamation point in the tool bar.
 
J

John W. Vinson

I am trying to sort a table

You can't.

A Table is an unordered "heap" of data. It's a data storage repository, NOT a
data presentation tool or a data editing tool!

Create a Query based on the table, and sort *that* by selecting the fields
that you want sorted in left-to-right order of sorting priority; put Ascending
or Descending on the order-by row of the query grid as appropriate, and view
the results in a Form based on this query.

John W. Vinson [MVP]
 
B

Bill Tarbox

Maybe I'm missing something but there are ways to sort tables.

1. If all you want to do is sort a table in ascending order you can use the
ORDER BY feature in the table's Properties. Example: [tbl Total
Liab].[Account Nr],[tbl Total Liab].[RelTy] (This sorts my "tbl Total Liab"
table in ascending order by Account Nr then by RelTy. I believe there's a way
to designate descending but I can't recall the syntax.)

2. To sort by ascending and then descending I've used the Primary Key
option, setting Account Nr and RelTy as Primary Keys (click on the Account Nr
row and then click the Primary Key icon on the tool bar and then the same for
the RelTy row). Using the Index icon, (next to the Primary Key icon on the
tool bar) I then change the Primary and the Unique options to No in the Index
Properties at the bottom. Then I rename the Index Name to Account Nr and
RelTy (originally defaults to the name Primary Key). I set the Sort Order for
Account Nr to Ascending and the RelTy to Descending. This works just fine in
my experience.

Bill
 
D

Douglas J. Steele

Tables aren't really intended to be sorted. That's what Queries are for.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bill Tarbox said:
Maybe I'm missing something but there are ways to sort tables.

1. If all you want to do is sort a table in ascending order you can use
the
ORDER BY feature in the table's Properties. Example: [tbl Total
Liab].[Account Nr],[tbl Total Liab].[RelTy] (This sorts my "tbl Total
Liab"
table in ascending order by Account Nr then by RelTy. I believe there's a
way
to designate descending but I can't recall the syntax.)

2. To sort by ascending and then descending I've used the Primary Key
option, setting Account Nr and RelTy as Primary Keys (click on the Account
Nr
row and then click the Primary Key icon on the tool bar and then the same
for
the RelTy row). Using the Index icon, (next to the Primary Key icon on the
tool bar) I then change the Primary and the Unique options to No in the
Index
Properties at the bottom. Then I rename the Index Name to Account Nr and
RelTy (originally defaults to the name Primary Key). I set the Sort Order
for
Account Nr to Ascending and the RelTy to Descending. This works just fine
in
my experience.

Bill

collette said:
I am trying to sort a table using customer name, address, City and state
using ascending, while at the same time sorting date by descending. It is
a
table of correspondence from various customers. I know it can be done,
just
not how to do it. I know how to sort by one column ascending or
descending,
but that is as far as I can get.
 
J

John W. Vinson

Maybe I'm missing something but there are ways to sort tables.

Not really.

Using the Access user interface you can *DISPLAY* the data in your tables in
sorted order. What's actually happening is that Access is creating a concealed
Query based on the table.
 

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