Results 1 to 3 of 3
  1. #1
    Emily is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    2

    Creating a query to pull all requests that didn't request something from 1 department

    I have a training request database. I have five table: Employee, Requests, RequestDetails, Enrollment, and TrainingTopics. I'm trying to pull all requests (designated by RequestNumber in the Requests table) that did not request training from the training department (designated by TrainingRequests in the RequestDetails table). Since there are some request numbers from some employees that requested training sometimes but not always, I am having trouble figuring out how to only pull those employees, or those requests, that did not request training at all. For example: Emily turned in a request form. It is request #6. She requested two training classes from the training department but not the third. Dan turned in a request form. It was request #7. He didn't request any of the three classes from the training department. All I want in my query/report are the employees/requests like Dan, who requested zero training from the training department. But the way my database is set up, I can only figure out how to pull all employees/requests with at least one null value in the TrainingRequests field of the RequestDetails table.

    My Employee table has fields: EmpID, EmpName, SpvrName, and Location
    My Requests table has fields: RequestNum, EmpID, and RequestDate
    My RequestDetails table has fields: LineNum, RequestNum,
    EmployeeRequests, SupervisorRequests, TrainingRequests, and
    Comments
    My Enrollment Table has fields: EnrollID, EmpID, TopicTaken, and
    DateTaken
    And my Training Topics table has fields: TrainingTopics as a lookup field


    from the RequestsDetails table and the Enrollment table.

    So, I'm trying to pull RequestNum's with zero TrainingRequests, not just RequestNum's with zero TrainingRequests for that row, but with zero TrainingRequests for that employee.

    Hopefully this made some sort of sense.
    Thanks.

  2. #2
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    Try this:

    Code:
    SELECT tblEmployee.EmpName, tblRequest.RequestNum, tblRequestDetail.LineNum, tblRequestDetail.EmployeeRequests, qryTrainingRequested.RequestNum
    FROM (tblEmployee INNER JOIN (tblRequest LEFT JOIN [SELECT tblEmployee.EmpName, tblRequestDetail.RequestNum, tblRequestDetail.LineNum, tblRequestDetail.TrainingRequests
    FROM (tblEmployee INNER JOIN tblRequest ON tblEmployee.EmpID = tblRequest.EmpID) INNER JOIN tblRequestDetail ON tblRequest.RequestNum = tblRequestDetail.RequestNum
    WHERE (((tblRequestDetail.TrainingRequests)="Training"))
    ]. AS qryTrainingRequested ON tblRequest.RequestNum = qryTrainingRequested.RequestNum) ON tblEmployee.EmpID = tblRequest.EmpID) INNER JOIN tblRequestDetail ON tblRequest.RequestNum = tblRequestDetail.RequestNum
    WHERE (((qryTrainingRequested.RequestNum) Is Null));
    Cheers,

  3. #3
    Emily is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    2

    Thank you!

    Thank you! I couldn't figure it out because it's been about eight years since I've had to do anything like this. I haven't been able to try it yet, but I'm thinking it's going to work. Thanks so much for replying!

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

Similar Threads

  1. Replies: 2
    Last Post: 05-08-2013, 03:37 AM
  2. request username and password
    By meysam_e2006 in forum Access
    Replies: 2
    Last Post: 07-02-2010, 02:03 AM
  3. Only pull out curtain data from a query
    By mela in forum Queries
    Replies: 0
    Last Post: 12-08-2009, 12:20 PM
  4. Replies: 1
    Last Post: 02-14-2007, 07:27 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