Crosstab query help...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eskelies
    New Member
    • May 2007
    • 55

    Crosstab query help...

    Hello all,

    I have a crosstab query that sets specific dates as field names. Is there an easy way to change the field name from date (numerical) to "Current date", but still give me the current dates information?

    I am running access 2003 and below is my SQL code:
    [Code=sql]
    TRANSFORM First(PRCJ830A.[Accrual Rate]) AS [FirstOfAccrual Rate]
    SELECT PRCJ830A.[Fund Number], IIf([Class] Is Null,0,[Class]) AS MultiClass
    FROM PRCJ830A
    GROUP BY PRCJ830A.[Fund Number], IIf([Class] Is Null,0,[Class])
    PIVOT PRCJ830A.Date;[/Code]
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You'll need an intermediary query that will convert your dates to the string of your choice.

    Comment

    • eskelies
      New Member
      • May 2007
      • 55

      #3
      Rabbit,

      Will I need to do something like this?

      [Code=sql]
      UPDATE PRCJ830A_Crosst ab SET PRCJ830A_Crosst ab.[01/11/2008] = Replace([Accrual Yield])
      WHERE PRCJ830A.[01/11/2008] ="Accrual Yield"
      [/Code]

      Originally posted by Rabbit
      You'll need an intermediary query that will convert your dates to the string of your choice.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Not quite. You want a query BEFORE the crosstab that will create another column that translates the dates to the string that you want.

        Comment

        • eskelies
          New Member
          • May 2007
          • 55

          #5
          In by doing this will it translate the date (ie. 1/14/2008...1/15/2008...etc.) into the string "Accrual Yield?"

          Do you know where I might find an example?

          Originally posted by Rabbit
          Not quite. You want a query BEFORE the crosstab that will create another column that translates the dates to the string that you want.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Code:
            iif([Accrual Yield]=#1/11/2008#, "Accrual Yield", [Accrual Yield])

            Comment

            • eskelies
              New Member
              • May 2007
              • 55

              #7
              Okay...I'm an idiot. Thanks Rabbit for your help.

              Originally posted by Rabbit
              Code:
              iif([Accrual Yield]=#1/11/2008#, "Accrual Yield", [Accrual Yield])

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                Not a problem, good luck.

                Comment

                Working...