Subsorting in Query

M

Mike P

Is there a way to make multiple sorts work in a query. There are three
fields I wish to sort on, datDate, txtCode, txtCompany. I would like to
have the output in atDate order, Accending. Then within the output, I’d
like to have the codes sorted, there are three types, X, Y, and Z. Finally,
with in that sort, I wish to have the companies subsorted. I need to this
this all in one query since I am using the DoCmd.TransferSpreadsheet to put
the output to a spreadsheet. Here is an example of the output I’d like in
case my explaination was not clear.
dDate, txtCode, txtCompany
3/3/08 X ABC Company
3/3/08 X Bravo Company
3/3/08 X Charlie Company
3/3/08 X Mike Company
3/3/08 Z Apple Company
3/3/08 Z Bannana Co
3/3/08 Z Cherry Co
3/4/08 X AB Company
3/4/08 X Delta Company
3/4/08 X Fox Company
3/5/08 Y A Again Company

I can’t figure it out. I seem to only be able to get one field to sort on
and the other subsort don’t work. Any ideas how to have this three level sort
in a query?
 
R

Ron2006

Open your query in design mode.

place those fields side by side (for visual clarity only)

Place them in this sequence: datDate, txtCode, txtCompany

In the sequence bucket for each select ascending or descending (which
every you want)

save the query.


The names do not sound correct. If the names shown are the form's
names then be sure to select the actual field names in the above
instructions.

As long as the fields are defined in the query in the sequence for the
desired sorts that is all that matters, Then can be anywhere in the
query but putting them side by side visually helps remember the
desired sequence 6 months from now when you look at the query again
and are trying to decide what is the hierarchy of the sort.

Ron
 

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