Results 1 to 3 of 3
  1. #1
    veejay is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Nov 2018
    Location
    Montreal, Canada
    Posts
    46

    Display a field even if empty


    I'm trying to find out if there's a way to display a field even if it's empty.

    I cannot share my DB since it's extremely large and I cannot anonymize my data but will try to be as clear as I can.

    One of the main table I have is called EMPLOYEES and it contains a list of names of employees.
    I also have another table which is linked to a form where you can fill any kind of information. That form is using a dropdown box to select which employee did what. It's possible that an employee didn't do anything for a given month. If he didn't do anything, it doesn't get reported on that table.

    Next let's move on to my first query, where I calculate the number of error/occurrence of stuff by employee.

    I was wondering how can I include every employee from my table in that query, even if they didn't do anything? I'd like to return 0 if nothing.

    Here's my SQL code:

    Code:
    SELECT TB.Date, TB.MONTHS, TB.EMPLOYEES, Count(TB.APP) AS REVIEWED_FILES
    FROM (SELECT MONTHPermanentTable.Date, MONTHPermanentTable.MONTHS, MONTHPermanentTable.APP, MONTHPermanentTable.EMPLOYEES FROM MONTHPermanentTable GROUP BY MONTHPermanentTable.MONTHS, MONTHPermanentTable.Date, MONTHPermanentTable.APP, MONTHPermanentTable.EMPLOYEES)  AS TB
    GROUP BY TB.Date, TB.MONTHS, TB.EXAMINER_S;

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    all queries display fields even when empty.
    tho you may want an OUTER join to show items not part of the criteria.

  3. #3
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Using a left outer join linking the Employee table to your other table so it gets data for all employees.
    The count field will be blank for those with no records.
    If you would prefer it to show 0, use the NZ function. Nz(Count(…),0)
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

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

Similar Threads

  1. Replies: 5
    Last Post: 09-17-2018, 11:06 AM
  2. Replies: 1
    Last Post: 02-28-2018, 01:02 PM
  3. Replies: 7
    Last Post: 03-07-2017, 12:54 PM
  4. Replies: 7
    Last Post: 07-15-2015, 03:42 PM
  5. Choose whether to display empty fields in a report
    By exoticdisease in forum Access
    Replies: 1
    Last Post: 08-18-2010, 09:12 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