Roundin specific input time

  • Thread starter Thread starter Pierre
  • Start date Start date
P

Pierre

Please, I need me.
I built a time management database and would like to round specific times up
or down.
For example whenever someone in time is between 7:16am to 7:33am, I would
like it rounded to 7:30am, in times between 8:16am to 8:33am to 8:30am and
all other in times around thoses ranges not to be rounded.
I have some individuals reporting at 7:30am and some at 8:30am, would prefer
the code to also round 8:16am to 8:33am as 8:30am as well.

Out time ranges between 4:00pm and 4:10pm round to 4:00pm and ranges 5:00pm
to 5:10pm rounded to 5:00pm and all other in times around thoses ranges not
to be rounded.

The two fields are set as short time and I input the time in 24h format.
Input field name is [In1] and output field name is [Out1]


Thanks in advance

Pierre.
 
See if these two subs help:

In time
'-------beg code-------------
Private Sub In1_AfterUpdate()

Select Case CDate(Me.In1)
Case TimeValue("07:16") To TimeValue("07:33")
Me.In1 = #7:30:00 AM#
Case TimeValue("08:16") To TimeValue("08:33")
Me.In1 = #8:30:00 AM#
End Select

End Sub
'-------end code-------------


Out time
'-------beg code-------------
Private Sub Out1_AfterUpdate()

Select Case CDate(Me.Out1)
Case TimeValue("16:00") To TimeValue("16:10")
Me.Out1 = #4:00:00 PM#
Case TimeValue("17:00") To TimeValue("17:10")
Me.Out1 = #5:00:00 PM#
End Select

End Sub
'-------end code-------------


HTH
 
Thank you very much, It did work.


Steve Sanford said:
See if these two subs help:

In time
'-------beg code-------------
Private Sub In1_AfterUpdate()

Select Case CDate(Me.In1)
Case TimeValue("07:16") To TimeValue("07:33")
Me.In1 = #7:30:00 AM#
Case TimeValue("08:16") To TimeValue("08:33")
Me.In1 = #8:30:00 AM#
End Select

End Sub
'-------end code-------------


Out time
'-------beg code-------------
Private Sub Out1_AfterUpdate()

Select Case CDate(Me.Out1)
Case TimeValue("16:00") To TimeValue("16:10")
Me.Out1 = #4:00:00 PM#
Case TimeValue("17:00") To TimeValue("17:10")
Me.Out1 = #5:00:00 PM#
End Select

End Sub
'-------end code-------------


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Pierre said:
Please, I need me.
I built a time management database and would like to round specific times up
or down.
For example whenever someone in time is between 7:16am to 7:33am, I would
like it rounded to 7:30am, in times between 8:16am to 8:33am to 8:30am and
all other in times around thoses ranges not to be rounded.
I have some individuals reporting at 7:30am and some at 8:30am, would prefer
the code to also round 8:16am to 8:33am as 8:30am as well.

Out time ranges between 4:00pm and 4:10pm round to 4:00pm and ranges 5:00pm
to 5:10pm rounded to 5:00pm and all other in times around thoses ranges not
to be rounded.

The two fields are set as short time and I input the time in 24h format.
Input field name is [In1] and output field name is [Out1]


Thanks in advance

Pierre.
 
Back
Top