Regarding Crosstab Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Raghavender143
    New Member
    • Oct 2007
    • 9

    Regarding Crosstab Query

    Hello everyone

    My problem is i am using a crosstab query in access,
    here is my scenario
    i am letting user to enter a date and the output should be the successive 3 months amount. say if i enter 4/1/07 then i should get
    AprAmt MayAmt JuneAmt
    ------------------------------------------------
    instead i am getting output as

    JanAmt FebAmt MarAmt AprAmt MayAmt JunAmt .......DecAmt
    ----------------------------------------------------------------------------------------------------

    How can i avoid the empty columns which a user dont care about.
    (I am using the Crosstab query)
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by Raghavender143
    Hello everyone

    My problem is i am using a crosstab query in access,
    here is my scenario
    i am letting user to enter a date and the output should be the successive 3 months amount. say if i enter 4/1/07 then i should get
    AprAmt MayAmt JuneAmt
    ------------------------------------------------
    instead i am getting output as

    JanAmt FebAmt MarAmt AprAmt MayAmt JunAmt .......DecAmt
    ----------------------------------------------------------------------------------------------------

    How can i avoid the empty columns which a user dont care about.
    (I am using the Crosstab query)

    Checkout the 'column headings' feature of crosstab queries right click in the query grid or view properties and enter the headings you want Access help documents it

    Jim

    Comment

    • Raghavender143
      New Member
      • Oct 2007
      • 9

      #3
      Originally posted by Jim Doherty
      Checkout the 'column headings' feature of crosstab queries right click in the query grid or view properties and enter the headings you want Access help documents it

      Jim
      Hi Jim

      My problem is not about naming column headings, i want to display the columns only what the user(suppose the user entered 4/1/07 i need to get april,may and June amount or if the user enters 6/1/07 i need to get only june.july and august months amount but now what i am getting is; if entered date is 4/1/07 april,may and june but i am also getting the other months which are empty so i dont want the rest of months to be displayed) wants, i am using column heading format as dateformat([date],"mmm")

      Comment

      • Jim Doherty
        Recognized Expert Contributor
        • Aug 2007
        • 897

        #4
        Originally posted by Raghavender143
        Hi Jim

        My problem is not about naming column headings, i want to display the columns only what the user(suppose the user entered 4/1/07 i need to get april,may and June amount or if the user enters 6/1/07 i need to get only june.july and august months amount but now what i am getting is; if entered date is 4/1/07 april,may and june but i am also getting the other months which are empty so i dont want the rest of months to be displayed) wants, i am using column heading format as dateformat([date],"mmm")


        Post the SQL of your crosstab please.

        What I am looking for is for you to have something like this in the Pivot clause of your SQL (which I was rather hoping you would give you what you required when I pointed you towards column headings in query properties where you in effect 'Fix' them in the query grid thus returning only the columns that you require)

        IN('Apr','May', 'Jun')

        Regards

        Jim

        Comment

        Working...