Results 1 to 8 of 8

Thread: Query Question

  1. #1
    Join Date
    Nov 2004
    Posts
    23

    Question Unanswered: Query Question

    I'm trying to run a query from a table with children ID, Date & Attended(which is a yes/no field) in the query criteria I would like a summary of the days attended(yes) for each child/ID. Any suggestions will be appreciated.

  2. #2
    Join Date
    Sep 2004
    Location
    Charlotte, NC
    Posts
    164
    Create a select query. In the first column put the ChildID and use GroupBy. In the next column put Date and use Count. In the next column put Attended and use Where and put Yes in your Criteria field.

    TD

  3. #3
    Join Date
    Nov 2004
    Posts
    23
    Thanks alot TD.

  4. #4
    Join Date
    Nov 2004
    Posts
    23
    I have another question. How do I calculate Total Hours worked for each employee for a particular week in a query.

    Employee attendance table consist of Employee#, Date, Time in & time out.


    Many thanks.

  5. #5
    Join Date
    Sep 2004
    Location
    Charlotte, NC
    Posts
    164
    If you use this code, each time you run the query, it will ask you to "Enter Start of Period" and "Enter End of Period" and will then return the total hours worked per employee.

    SELECT [Employee Attendance].[Employee#], Sum(round(24*([Employee Attendance]![Time Out]-[Employee Attendance]![Time In]),2)) AS [Hours Worked]
    FROM [Employee Attendance]
    WHERE ((([Employee Attendance].Date) Between [Enter Start of Period] And [Enter End of Period]))
    GROUP BY [Employee Attendance].[Employee#];

    TD

  6. #6
    Join Date
    Nov 2004
    Posts
    23
    Thanks alot!!! But can you guide me a bit as to what I have to do to put that code in?

    Forgive me, I'm still learning Access.

  7. #7
    Join Date
    Sep 2004
    Location
    Charlotte, NC
    Posts
    164
    Start a new query in Design Mode. Click the arrow on the View Icon which is the Left Most Icon on your Toolbar and select SQL View. Copy my code and paste it in and change any of the table or field names that may not be exactly what you have called yours. You do not need to change the [Enter Start of Period] and [Enter End of Period] because those are dynamic parameters that will ask you for this information each time the query is run, thereby allowing you to pick a different period each time.

    TD

  8. #8
    Join Date
    Nov 2004
    Posts
    23
    This worked perfect!!!!!

    Thanks alot TD.

Posting Permissions

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