Subtract Times

SerenityNet

Registered User.
Local time
Today, 11:41
Joined
May 6, 2003
Messages
27
Say I have four fields, only one of which will be submitted to the DB. Form field one is "Time_In" (short time). Form field two is "Time_Out" (short time). Form field three is "Time_Wasted" (minutes?). Form field four is "Time_Worked" (minutes?). Only form field four will be submitted to the DB.

I want to have form field four default to a value calculated by (Time_Out minus Time_In) minus Time_Wasted. :confused: However, I don't have a clue as how to accomplish this.

Any help will be appreciated.
Andrew
 
Time_out - Time_In -Time_Wasted

use that as a default value, not sure if that keeps updating tho.

If not add

Me.Time_Worked = Time_out - Time_In - Time_Wasted

To your after update event of all 3 fields. Also remember to take into account Nulls.

Tip: Dont use _ in fieldnames Try using TimeWasted instead....

Regards
 
Me.Time_Worked = (Time_out - Time_In) - (Time_Wasted /60)
 
Sorry bout that one, good catch Mile !

Regards
 
Still and error

Hello,

Attached is a gif of how I have the fields set up. However, I'm receiving an error. Can you advise?

Thanks again,
Andrew
 

Attachments

  • timeerror.gif
    timeerror.gif
    32.5 KB · Views: 151
Take the [Me].[TimeWorked] out of your default value and put the formula starting from the equals sign in the ControlSOurce.


Delete the Default Value...
 
Thanks

Thank you all very much.

=(([TimeOut]-[TimeIn])*24)-([TimeDC1]/60+[TimeDC2]/60+[TimeDC3]/60) in the Control Source works perfectly.
 

Users who are viewing this thread

Back
Top Bottom