Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time Related to Shift

Status
Not open for further replies.

kimba45

Programmer
Jul 10, 2006
2
US
I am creating a data entry form that requires the user to enter start and end times for an event. I am trying to make the start and end times automatically calculate which shift the event occured. For example, 1st shift is 7am to 3pm. I would like the shift to appear once the start & end times are entered in the form.
How do I setup the code?

Thanks
 
You will have to come up with something yourself...I can't think of any predefined functions that will help.

You will need to check if the start time is between a certain range.... Format([StartTime], "hh") Between 7 And 3
and then do the same for the end time maybe...if that matters.

My only comment is how do you plan to handle crossovers or an time that is "just" outside your ranges...
So if the start time is 6:49 and end time is 3:07, does that qualify as first shift, or second, or whatever???

I would suggest just supplying a choice of shifts and letting the users select that as well, if this an item that needs to be captured. Otherwise, I think you will have some difficulty coming to a solution that will ALWAYS find the appropriate shift based on your criteria.

But feel free to repost specific questions and maybe some sample code, data, and expected results and I will be glad to try to help work something out as close as possible.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top