Results 1 to 4 of 4
  1. #1
    kattatonic1 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Location
    Toronto, Canada
    Posts
    77

    Question Count of active employees per department

    I have Departments, and Employees in Departments. Employees can be deactivated for various reasons (leaves of different kinds, secondments, etc.) so there is a field strEmployeeStatus. If strEmployeeStatus = "A", she be active; if strEmployeeStatus = "I", she be inactive. I need a query that tells me how many active employees there is in each department. I am thinking create a field with a query? I don't want to list the employees. I just want a total for each department.



    Any suggestions appreciated,

    Kay
    from Toronto

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Air code /untested

    Select Department, strEmployeeStatus, Count(Employees)
    From EmployeesInDepartment
    Group by Department, strEmployeeStatus

  3. #3
    kattatonic1 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Location
    Toronto, Canada
    Posts
    77
    Thanks for your quick reply, Orange! I have realized that I asked the wrong question. Ugh.

    I have a form for Departments with departmental data. On that form I simply want a field that is a calculated count of active employees for that department. I would use the criteria that all related employees with strEmployeeStatus = "A".

    So I suppose I need a calCountofActiveEmployees field. I can't put it in the Departments table because it won't let me choose from a related table in the calculation.

    I have designed a query that counts the active employess, but it won't let me add any non-totalable fields to the query.

    Am I missing something simple?

    Kay
    in Toronto

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Look at this link and see if you can use a DCount().

    What is the current recordSource of your Form?

    Can you zip a copy of your database -- remove anything confidential/private.
    Just need enough records to show the issue.

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

Similar Threads

  1. Replies: 1
    Last Post: 01-31-2014, 11:03 PM
  2. Replies: 1
    Last Post: 01-11-2014, 12:39 PM
  3. Replies: 8
    Last Post: 09-10-2013, 05:32 PM
  4. Replies: 8
    Last Post: 08-16-2012, 09:04 AM
  5. Replies: 3
    Last Post: 08-26-2010, 02:11 PM

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