• Crosstab Query Column Sort (Access97)

    Author
    Topic
    #371778

    I’m trying to sort by month and year for a 6 month period in a crosstab query.
    Expr1: Format([LAST_SRVC_DATE],”mm/yy”) is my column heading sorted ascending.
    This is producing 01/02, 02/02, 03/02, 10/01, 11/01, 12/01
    Anything I try won’t sort it correctly
    I want it to display as:
    10/01 11/01 12/01 01/02 02/02 03/02
    Help! Its late and my brain hurts

    Viewing 1 reply thread
    Author
    Replies
    • #592062

      Open your query in design view.

      Click on the Column Heading (Crosstab Row) and open Properties.

      In Column Headings, type in the dates in the order you want, as in “11/01″,”12/01″,”01/02″,”02/02”, etc. Include the quotes (maybe single quotes, to keep things consistent in your query).

      HTH,

      Tom

      • #592065

        Tom,
        Should have stated that these aren’t static values. Every month a new month is added and the earliest month drops off.
        Is there a way to automatically fill the column headings?
        Scott

        • #592067

          Scott,

          Attached is an Access 97 db that shows how to use a rolling crosstab report – it seems to do what you want.

          This one is designed for twelve months of data, but you can modify it to meet your needs.

          HTH,

          Tom

          • #592181

            Thanks Tom,
            I will use that if I can’t figure this one out. I already have the dynamic report built.
            Just need to sort it correctly
            Thanks

    • #592063

      Add the following to the query: Year([YourTbl].[DateField])*12+DatePart(“m”,[YourTbl].[DateField])-1 and order by that

      • #592066

        Rich,
        That sorted the colums correctly but the column labels are 24021 24022 24023 24024 24025 24026
        not the mm/yy
        Scott

        • #592086

          Don’t output the field I gave you, just set it to Where on the total field

    Viewing 1 reply thread
    Reply To: Crosstab Query Column Sort (Access97)

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

    Your information: