Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Theory/Advice to find "missing data"

    The question is relating to how we will deal with contractors timesheets. There are currently 4 tables this could relate to,

    Staff - engineer info (name)

    Timesheet - info about that weeks work (hours miles ect)

    PO - this is the order number and description for that engineers time

    Weekending - I've made a table that lists every Sunday for about two years. (This is used as a validation check for info we receive.)

    the line engineers table Isn't relevant for this.

    Click image for larger version. 

Name:	Screenshot_7.png 
Views:	13 
Size:	23.2 KB 
ID:	27510


    My problem:



    I want to show ever engineer that does not have a time sheet < date(). I'm willing to restructure if the idea of listing all the Sundays isn't the best one.

    Just some advice in the direction I'm heading would be appreciated. I've been using unmatched query's for most of the day and had no success.

    Thanks in advance, Andy

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    you would use a left join, not quite sure what your tables are showing - perhaps provide some example data.

    But in principle it would be

    SELECT S.*
    FROM staffT S LEFT JOIN (SELECT EngineerID FROM PO_Engineers E INNER JOIN TimesheetData T ON E.Engineerid=T.engineerid WHERE T.Weekending<Date()) X ON S.StaffID=X.StaffID
    WHERE X.EngineerID IS NULL

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    I'm still testing/reading. Just to try an explain a bit better.

    If I have 5 engineers that did not submit a timesheet last week I want to see their name and the date of when they didn't submit. so the date record in this case would appear 5 times.

    also if an engineer didn't submit for the past 5 weeks then his name would appear 5 times. (with the corresponding dates not submitted)


    I think I'm getting closer.... But as always your input is appreciated

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    Not sure why you are getting 5 records when it should be returning only those without a record

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    No, this is what I want to see that's why this is difficult. I want to see the 5 or 6 or however many weeks information I'm missing g for however many people.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    misread your post.

    in that case you will need a slightly different query

    Replace

    ...staffT S LEFT JOIN ....

    with

    ...(SELECT DISTINCT StaffID, Weekending FROM StaffT, TimesheetData WHERE Weekending<Date) S LEFT JOIN ....

    As before, you don't need the weekending table, just put the weekending value back into timesheetdata instead of the weekendingID. The only time the above won't work is if none of the engineers have submitted a timesheet.

    If this matters, you just need a table of dates and replace TimesheetData in the above change with the name of the table, you don't need to link it to timesheetdata

  7. #7
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Okay. Well. I have some reading to do. Thanks

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

Similar Threads

  1. Replies: 3
    Last Post: 07-07-2016, 12:22 PM
  2. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  3. Replies: 4
    Last Post: 04-30-2014, 08:56 AM
  4. Form Filter "Missing Data" Using VBA
    By r0v3rT3N in forum Programming
    Replies: 12
    Last Post: 07-20-2012, 12:40 PM
  5. Replies: 3
    Last Post: 07-23-2011, 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