misssoysauce
Technical User
I have a report that calculates charges based on the amount of time a piece of equipment was on hire. This works by subtracting an on-hire time from an off-hire time to get an interval. Of course, a bug comes up whenever a job is still on-hire, i.e. no off-hire time is entered in the database.
So I would like to create some code that would replace the current date and time as the off-hire time for records with Null values, thus giving me an up-to-the minute cost for the rental, and eliminating the bugs.
The code below works when an off-hire time IS given, but returns 'Null', not the current time and date, when Null. How do I fix this?
Public Function SetOff(timeoff)
If timeoff = Null Then
OT = Now()
Else
OT = timeoff
End If
SetOff = OT
End Function
Many thanks in advance for your advice/help!!
So I would like to create some code that would replace the current date and time as the off-hire time for records with Null values, thus giving me an up-to-the minute cost for the rental, and eliminating the bugs.
The code below works when an off-hire time IS given, but returns 'Null', not the current time and date, when Null. How do I fix this?
Public Function SetOff(timeoff)
If timeoff = Null Then
OT = Now()
Else
OT = timeoff
End If
SetOff = OT
End Function
Many thanks in advance for your advice/help!!