Forum Discussion

Sullster47's avatar
Sullster47
Copper Contributor
Nov 24, 2022

Taking 30 minutes off a time

I am working on a time management system and need to deduct 30 minutes for break time. I cannot seem to get it to work any way I have tried. Can someone please help? 

So far, I have got it to work out which paygrade to put the hours in, and if it crosses over into another pay grade (overtime) it works out how many hours to put in that rate, but I need to knock off 30 minutes for break and this is where I am falling down.

Thanks in advance.

3 Replies

    • Sullster47's avatar
      Sullster47
      Copper Contributor
      I think I have figured it out now. Thanks for your help.
    • Sullster47's avatar
      Sullster47
      Copper Contributor

      I have the start time and the finish time and have then worked out the hours worked. (08:00-16:00 = 8). This is held in another field for ease. I then need to take off x minutes depending on customer.
      I have brough through the customers minutes to be deducted.


      Set Thisdb = CurrentDb
      Set Recs = Thisdb.OpenRecordset("QryCustomersDepotsSingleDepot", dbOpenDynaset)
      Set Bookings = Thisdb.OpenRecordset("QryBookingSingleBooking", dbOpenDynaset)
      Set UpdateHrs = Thisdb.OpenRecordset("QryTimeDiffUpdate", dbOpenDynaset)


      UpdateHrs.MoveFirst
      HrsLeft = UpdateHrs!Hrs


      Recs.MoveFirst
      ThisCustomer = Bookings!BCustomer

      Set CDBreak = Thisdb.OpenRecordset("QryCustomerDepotsSingleDepot", dbOpenDynaset)

      RateTimeStart = Recs!CDWHRate1Text
      RateTimeEnd = Recs!CDWHRate2Text
      CDBreak.MoveFirst

      BreakTime = CDBreak!CDBreakTimeDed

      If BreakTime = "0.5" Then
      BreakTimeMins = "00:30"
      Dateadd("n",-30,[hrsleft])

      Thanks for your help Karl

Resources