Results 1 to 10 of 10
  1. #1
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181

    Crosstab Query

    Hello



    I have done a crosstab query and I get the results I was looking for. However, there is a column which shows up in the query and I am unsure why. It is the column with <>., highlighted in yellow. I can't seem to delete the column and when I print to Excel this column is present, which I don't want. I have tried hiding the column but it still is displayed in Excel. The SQL generated is below:



    TRANSFORM Last(qCoursesAttendedReport.[Course Check]) AS [LastOfCourse Check]
    SELECT qCoursesAttendedReport.LastName
    FROM qCoursesAttendedReport
    GROUP BY qCoursesAttendedReport.LastName
    PIVOT qCoursesAttendedReport.EventName;
    Attached Thumbnails Attached Thumbnails CrossTab.PNG  

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    The source of your crosstab is another query (qCoursesAttendedReport)? Suggest you show that sql as well as it may be caused by that one.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    Quote Originally Posted by hinchi1 View Post
    Hello

    I have done a crosstab query and I get the results I was looking for. However, there is a column which shows up in the query and I am unsure why. It is the column with <>., highlighted in yellow. I can't seem to delete the column and when I print to Excel this column is present, which I don't want. I have tried hiding the column but it still is displayed in Excel. The SQL generated is below:



    TRANSFORM Last(qCoursesAttendedReport.[Course Check]) AS [LastOfCourse Check]
    SELECT qCoursesAttendedReport.LastName
    FROM qCoursesAttendedReport
    GROUP BY qCoursesAttendedReport.LastName
    PIVOT qCoursesAttendedReport.EventName;
    SELECT DISTINCT tblMembers.LastName, tblMembers.FirstName, tblEvents.EventName, tblJunction.DateCompleted, tblJunction.RenewalDate, IIf([DateCompleted]<=Date(),"✓") AS [Course Check]
    FROM tblMembers LEFT JOIN (tblEvents RIGHT JOIN tblJunction ON tblEvents.Events_PK = tblJunction.Events_FK) ON tblMembers.Members_PK = tblJunction.Members_FK;

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Hard to see a relationship between the ct results and the first query in the stack but I guess it's there. I would try replacing the check within the IIF function with "Y" or a number like 0 and test that.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    hinchi1 is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2017
    Posts
    181
    Quote Originally Posted by Micron View Post
    Hard to see a relationship between the ct results and the first query in the stack but I guess it's there. I would try replacing the check within the IIF function with "Y" or a number like 0 and test that.
    Will give it a try. I have coded the column out when exporting to Excel, so not such a problem, but would be good to if what you suggested works.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    That column reflects records that don't have a value in EventName.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Quote Originally Posted by June7 View Post
    That column reflects records that don't have a value in EventName.
    I realize the field names in the ct query will come from transposed groups of values but how does that give the field a name of "<>"?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Access just does that automatically. There is no data for the header so it just uses <>. Try it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Thanks, but I'll take your word for it. Can't recall ever seeing that before. Would have thought it would just eliminate the column.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Nope. The field has Null (or empty string - which I never allow in tables) and the CT still has to aggregate the record(s). If CT used IN() function then the records could be ignored.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 12-19-2019, 12:23 PM
  2. Replies: 17
    Last Post: 07-13-2017, 05:23 PM
  3. Replies: 8
    Last Post: 05-11-2017, 07:54 AM
  4. Replies: 2
    Last Post: 08-16-2013, 01:36 AM
  5. Replies: 1
    Last Post: 07-30-2010, 10:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums