How do I sort a table by 2 different field types?

  • Thread starter Sierre Demonte Aires
  • Start date
S

Sierre Demonte Aires

I am trying to sort an Access 2007 table that I created, first by the Primary
Key Field and then by the Date Field. and I really do not feel like creating
a query, so how can I go about doing that?
 
R

Rick Brandt

Sierre said:
I am trying to sort an Access 2007 table that I created, first by the
Primary Key Field and then by the Date Field. and I really do not
feel like creating a query, so how can I go about doing that?

Tables cannot be sorted. Period.

When you view a table's datasheet Access is producing something visual for
you to see the data. The data viewed in that "thing" can be sorted and it
can be fiddled with as far as moving columns around, changing column widths,
etc., but none of that affects the actual table under the covers. None of
it affects how the table's data is reflected in forms, reports, queries, or
code.

SELECT *
FROM TableName
ORDER BY ThisField, ThatField


The query above would take all of 10 seconds to produce. What is your
objection to doing so?
 
J

John W. Vinson

I am trying to sort an Access 2007 table that I created, first by the Primary
Key Field and then by the Date Field. and I really do not feel like creating
a query, so how can I go about doing that?

You don't.

Tables are for storing data.

Queries are for selecting, combining and sorting data.

Forms are for displaying data onscreen.

Reports are for printing.


Use the correct tool for the job you're trying to do.
 
J

John Spencer

One other thing.

If you have sorted by the primary key, then there is no other sort to do.
Primary key is unique and therefore sorting by the primary key is going to
produce a unique order so any subsequent fields involved in the sort will have
NO impact.

If you want to sort by the date field and then by the primary key field then
you will have a different sort.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 

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