Results 1 to 4 of 4
  1. #1
    mduplantis is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2010
    Location
    Omaha, Ne
    Posts
    65

    Sorting and Grouping

    I have a database that is already established and working, but I need to make a new query, which is no problem. But, I need to group and sort. First of all I need to sort based on classifications. I am using design view to do this within my query. it is not ascending or decending, but instead it is based on a rank from highest to lowest classification. Kinda like the military, Generals of top, privates on the bottom. Is there a way to use an operator for this?



    The second sort is based on seniority dates with in the classifications. So all the generals in a group and then within that group, the most senior to the least senior general.

    This might be done in a report with group and sorting? Just not sure the best method of accomplishing this.

    Thanks for any tips

  2. #2
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You have to tell Access the order at some point. If you have many "ranks" then you should have a table that holds that information as well as the sequence of the ranks

    tblRanks
    -pkRankID primary key, autonumber
    -txtRankName
    -longRankSequence

    Data in the table may look like this

    pkRankID|txtRankName|longRankSequence
    1|Private|8
    2|General|1
    3|Major|3
    etc.

    Then in your table that holds the information about the people reference the pkRankID as a foreign key.

    tblPeople
    -pkPeopleID primary key, autonumber
    -txtFName
    -txtLName
    -fkRankID foreign key to tblRank
    -ServiceDate

    Then in your query, you can join the tblPeople to tblRank and select the longRankSequence field to do your sorting.

    SELECT txtFName, txtLName, longRankSequence, ServiceDate
    FROM tblPeople INNER JOIN tblRanks ON tblPeople.fkRankID=tblRanks.pkRankID
    ORDER BY longRankSequence, serviceDate

  3. #3
    mduplantis is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2010
    Location
    Omaha, Ne
    Posts
    65

    thanks

    Ok, that makes sense. I just did not know if there was an operator that you could simply use. But, I see now that I'll have to set the order.

    thanks

  4. #4
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You're welcome. Good luck with your project.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Grouping By Age
    By xnixiel in forum Queries
    Replies: 1
    Last Post: 07-01-2010, 09:14 AM
  2. Grouping strings
    By Fre in forum Access
    Replies: 16
    Last Post: 04-24-2010, 03:46 PM
  3. Need help grouping results.
    By cljac in forum Queries
    Replies: 9
    Last Post: 03-24-2010, 10:10 AM
  4. Grouping
    By dref in forum Reports
    Replies: 1
    Last Post: 01-16-2010, 08:30 AM
  5. Access report with 3 tables -grouping,sorting
    By kartechy in forum Reports
    Replies: 0
    Last Post: 07-22-2009, 09:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums