Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2019
    Posts
    1,067

    Issues with query (linked to crosstab) when a value (for column heading) is missing

    Hello:

    I'd like to get some assistance with a query linked to a crosstab query. I'll provide some background first.

    Background (file "SampleData_v01"):
    - Attached sample DB (v01) includes table [T_Sample_Data_1] including 17 sample records.
    - In v01, field [CONCURRENCE_FINAL] has 3 distinct values: "---", "Concur", and "Non-Concur" where latter value exists in sample record #17 only.
    - Crosstab query "Q_SampleData_CT" uses field [CONCURRENCE_FINAL] for the column heading.
    - Now, subform (SF) query "Q_SampleData_SF" works without issues as I have values (i.e., "---", "Concur", and "Non-Concur") for all column headings.
    - FYI... please note that the query's criteria is set to "ABC" & "Alpha" but the query criteria is NOT related to the underlying issue.

    ... again, all works great in version 01.



    Now, let's review version 02 (copy of v01).

    Current Issue:
    - Table [T_Sample_Data_1] now includes only 16 sample records (1 less than v01). That is, I purposefully deleted record #17 in this version (that was the only record containing "Non-Concur").
    - While crosstab query "Q_SampleData_CT" still executes, I now experience an issue with the 2nd query (subform) "Q_SampleData_SF".
    - Specifically, the 2nd query no longer opens given I do NOT have any values for "Non-Concur" in my sample data any longer.

    My question:
    - How do I need to modify query "Q_SampleData_CT", so that it still displays the "Non-Concur" column even if the source table has zero values for it?
    - That is, I somehow just need a, e.g., "dummy placeholder" for the "Non-Concur" column where value count should be equal to default value of, e.g., zero (0) across all row values.
    Attached Files Attached Files
    Last edited by skydivetom; 05-11-2024 at 02:00 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Thread is marked Solved. Is it?

    If you want to force column headings to display even when there is no data for that category, must specify headings with IN() clause. Review http://allenbrowne.com/ser-67.html#ColHead
    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.

  3. #3
    Join Date
    Feb 2019
    Posts
    1,067
    Yes, it is solved.

    I found solution where I could force field headings in query's column heading properties. Thank you.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,746
    Tom,

    You might want to post a sample showing the related code and some descriptive material. It might be helpful to others. I'd suggest the Code Repository as the appropriate spot.
    Good luck.

  5. #5
    Join Date
    Feb 2019
    Posts
    1,067
    Orange:

    Please see attached screenshot. Entering crosstab's field headers (e.g., "A", "B", "C", "D", "E") into the column headings will include all fields in the crosstab query even if there are no values for fields/column, e.g., "B" in the data source.
    Attached Thumbnails Attached Thumbnails Screenshot 2024-05-12 083755.png  

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

Similar Threads

  1. Replies: 2
    Last Post: 03-14-2017, 12:25 PM
  2. Replies: 3
    Last Post: 09-21-2016, 10:11 AM
  3. Replies: 4
    Last Post: 07-27-2012, 07:04 AM
  4. Replies: 3
    Last Post: 02-21-2012, 10:15 AM
  5. Replies: 20
    Last Post: 02-14-2011, 10:55 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