Query sorting help

D

Darren

I am in need of assistance with a Query. I have a query that assembles a
daily production schedule. The shedule consists of many fields however for
the sake of this question i wish to sort the query by a series of four
fields. the first fiedld in the query is "DueDate" then by field "press1"
then by "Press2" then Press3". The data in the field Due date is the actual
date due. The data in "press1" will only be "6c" or nothing. The data in
"Press2" will be one of three Strings: "25", "29", or "25/29". The data in
"Press3" will only be a string of "17" or nothing. NOTE:It is possible that
one column to have data in all three press fields or any combination of press
fields.

KO, Now the desired result;

I wish to display the data first by Field "Press1" if data exists display it
first and display it in assending order by field "DueDate". Then display
field "Press2" if data exists display it emdiatly after the data from field
"Press1" in order by field "DueDate" displaying duplicate data. Then display
field "Press3" if data exists display it emdiatly after the data from field
"Press2" in order by field "DueDate" displaying duplicate data.

Please Help!!!!!!!!!!!!

DarrenC
 
K

KARL DEWEY

Try this --
SELECT YourTable.Press1, YourTable.Press2, YourTable.Press3, YourTable.DueDate
FROM YourTable
ORDER BY YourTable.Press1, YourTable.Press2, YourTable.Press3,
YourTable.DueDate;

If this is not what you need then put your example output data in an Excel
and then paste in a post.
 
D

Darren

This is a single flat database with all data posted in colums like excell. I
now it is very basic but it works for this user. What I have currently is a
query that simply filters by due date in ascending order for all active data.
Each of the Press1-3 data is in its own column of the database. The desired
result is to sort by press column first then sort found data by date. I just
don't get how to order the search but a spacific column first and also show
duplicate items. By duplicate items I mean if a job has pieces on all three
presses I want to show it in all three sorts. Example I want to sort by
press1 first. Many items from press1 have pieces on Press2 and press3. Then
at the end of the Press1 sort and display press2 items with any and all
pieces for Press1 and press3.

I have screen captures of the sections of the query results and a screen
capture of the query in design view however I cant seem to be able to attatch
them to this post. Thanks Carl for your assistance.
 
J

John Spencer

PERHAPS

Order By NZ(Press1,Nz(Press2,Press3)), DateField

In the query grid, add a calculated field
Field: SetOrder: NZ(Press1,Nz(Press2,NZ(Press3,"ZZZZZ")))
Sort:: Ascending

Then follow that by sorting on the Date field
--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
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