• ‘Content based’ sort order? (AXP 10.2627.2625)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » ‘Content based’ sort order? (AXP 10.2627.2625)

    Author
    Topic
    #365706

    Not sure what to even call this idea…

    I have a list of school levels: PK, K, 1, 2, … 8

    At the moment, i have a Student table with the grade name in each student’s record. When I sort by grade, I get the usual alpha sort, but would prefer the PK, K, 1,.. order.

    I am thinking that to obtain the “grade name ordered sort”, I need to reorganize the schema: make two tables, such that the Student table and the Grade Name tables are linked.

    Am i on the right track, or is there an easier way i am overlooking?

    Viewing 1 reply thread
    Author
    Replies
    • #565130

      I agree with your thoughts. The Grade Name table would also include a data field you could sort on. (i.e, create a grade name table with a field for Grade Number and then a field for sort order. When linking the tables, you could then sort on the sort order number to get the correct sort order.

      Being that there are a limited number of levels from PK to 8, you could also use an IF Then statement to help with the sort, however, I would go with the two tables.

    • #565142

      I’m not sure if my suggestion is related to your train of thought or not. Here’s what I would do: Create a separate field in the Grades table called GradeID. Make it a Number field – since the table will have a limited number of entries there shouldn’t be a need for Autonumber. Number the items starting with 1 for PK, 2 for K, and so on.

      Include the GradeID field in your queries and sort by it, but don’t show the data from it.

      Post back if you need further clarification for my random thoughts…HTH salute

      • #565200

        Thanks Gary & mark – that’s pretty much what i thought, and did.

    Viewing 1 reply thread
    Reply To: Reply #565142 in ‘Content based’ sort order? (AXP 10.2627.2625)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel