Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cross Tab Query (Access 2000)

    I have the following Cross Tab query. When I run it with out the sub select it works, but returns an incorrect record set.
    When I add the sub select, it does not run. I get the error the the tblCompensation.personnelID is not a valid column.

    I am using this exact sub select in a couple of other queries and it is working correctly in them.


    TRANSFORM Sum(tblCompensation.amount) AS SumOfamount

    SELECT tblPersonnel.lastName

    FROM tblCompensation INNER JOIN tblPersonnel ON tblCompensation.personnelId=tblPersonnel.personnel Id

    WHERE (((tblPersonnel.lastName) Is Not Null)
    AND ((tblCompensation.pass) In
    (SELECT Max(A.pass) AS MaxOfpass
    FROM tblCompensation A
    WHERE tblCompensation.personnelID = A.personnelID
    AND (
    ( A.pass>=GetThisPass()
    And A.pass< (GetThisPass()+1)
    )
    OR a.pass = 0
    )
    AND A.year=2005 )))

    GROUP BY tblPersonnel.lastName, tblCompensation.personnelId

    PIVOT tblCompensation.year;

    Any ideas why the tblComepnsation.pesronnelID is not being recognized as valid?
    Richard

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cross Tab Query (Access 2000)

    You're doing too much at once. Create a select query that selects the correct records (using the criteria you have), and save this query. Then create a crosstab query based on the query you just saved.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cross Tab Query (Access 2000)

    I was afraid that would be the case.

    Thanks for your help.

    I created a query that returns the correct values and have the cross tab using it as the record source.
    Seems to be working correctly now.
    Richard

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •