Results 1 to 7 of 7
  1. #1
    boywonder381's Avatar
    boywonder381 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Memphis, TN
    Posts
    28

    Cool How to code base on days and hours of shifts

    I'm working on a scheduler and is in need of a way to code a course based on a day shift and a evening shift. I figured out the day shift, but because the evening shift starts at 6PM and ends at 6AM, I can not get the greater than or less than properly set up. The day time is from Monday thru Friday, 8 to 5pm and the evening is from Saturday thru Monday. Check it out, this is part of the evening shift code, when it decide to go to the next day:

    TimeBeg = rsClassRoom![TimeEnd]
    CDuration = DateAdd("n", rsCourses![TotalClassroomDuration], TimeBeg)



    DN = Weekday(DateFrom)
    If CDuration > rsShifts!TimeEnd Then
    If rsShifts!TimeBeg > rsShifts!TimeEnd Then
    If CDuration < #11:59:00 PM# Then
    GoTo ByPassShiftRange
    End If
    End If

    ' This is to set the days of the shift right
    If DN = SDays1 Then
    DateFrom = DateFrom + SDays2
    L = 0
    TimeBeg = rsShifts!TimeBeg
    Else
    DateFrom = DateFrom + 1
    L = 0
    TimeBeg = rsShifts!TimeBeg
    End If
    End If

    The times looks like I got those right, but it will only show the first day of the date range. I would like to use it by the hours of the day, such 1 thru 8 hours, instead of calculating the 8AM thru 5PM hours. Please helllllllppppp...

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    The way I do it is using a table for the type of shift with the shift,beginday,endday.
    Then you can define the shift in your query easily.


    HTH
    Attached Thumbnails Attached Thumbnails DayShift.jpg  

  3. #3
    boywonder381's Avatar
    boywonder381 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Memphis, TN
    Posts
    28
    This is a course scheduler. I do have a shift table with the beg and end times, along with the beg day and end day. The day shifts was easy cause the am is always less than the end time. The evening shift is greater than until it get past 1AM, then it will be less than the end time. I've tried many ways with no results.

  4. #4
    boywonder381's Avatar
    boywonder381 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Memphis, TN
    Posts
    28
    I need for the code to work whether the shifts are from 8 to 5 or 11pm to 7am. Even in the reports it is showing the end time first.

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    This is my approach. Hope it help!
    Attached Thumbnails Attached Thumbnails ShiftScheduler.jpg   EveningShift.jpg  

  6. #6
    boywonder381's Avatar
    boywonder381 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Memphis, TN
    Posts
    28
    Yeah, I see what you are doing. I'm creating a course scheduler, not counting hours. The day shift is done... But the night shift is kicking me in the butt. I know I'm gonna have to start from scratch and step by thru the code process for the night shift by itself. Right now, it is combined with the day shift (which I think is the problem). It will be an all nighter. It's in my mind what I need to do. Once I finish, I will post it, so you guys can see what I was trying to do.

  7. #7
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Counting hours is just a added feature.

    Good Luck With Your Project!

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

Similar Threads

  1. Replies: 4
    Last Post: 09-18-2014, 06:41 AM
  2. Replies: 6
    Last Post: 05-01-2013, 06:37 AM
  3. Replies: 1
    Last Post: 08-08-2012, 01:42 PM
  4. Replies: 4
    Last Post: 08-06-2012, 10:25 AM
  5. Formula for counting shifts
    By Huddle in forum Access
    Replies: 4
    Last Post: 05-10-2012, 02:56 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