Calculating According To Duration

charlesandrews

Registered User.
Local time
Today, 12:20
Joined
Dec 28, 2003
Messages
27
I have a form with three fields:

CallStart
CallEnd
Cost

When a call is logged, I have it set that the time is entered automatically viz =now(). I would like it where if the cost = £20.00 the call end would be automatucally 30mins ahead. If the cost = £40.00 then the call end would be 1 hour ahead. And if the call costs £10.00 then the call end would be 15mins ahead.

Any help would be appreciated.
 
Copy the function below and use it in a DateAdd function in the ControlSource of the CallEnd textbox.

i.e.

Code:
Private Function GetMinutes(ByVal CallCost As Currency) As Long
    Select Case CallCost
        Case Is = 10
            GetMinutes = 15
        Case Is = 20
            GetMinutes = 30
        Case Is = 40
            GetMinutes = 60
        Case Else
            GetMinutes = 0
    End Select
End Function

i.e. =DateAdd("n", GetMinutes([txtCallCost]), [txtCallStart])
 
Many thanx SJ,

I followed your example and all works fine. The only thing, is that I put it on the open form event. Seems to work fine, do u see any problems storing the function there?
I do not know where you meant be to place your code.

Many thanx
Charlie
 

Users who are viewing this thread

Back
Top Bottom