A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Time calcuation in a form?



 
 
Thread Tools Display Modes
  #1  
Old May 5th, 2008, 03:52 PM posted to microsoft.public.access.forms
jackrobyn1
external usenet poster
 
Posts: 43
Default Time calcuation in a form?

I have a form that has time fields [Timefrom] and [Timeto] and [Total]. The
times represent the period of time a vehicle was off the road. eg. 14:20pm -
15:35pm, should read 1:15 in the [Total] field, i want to set the [Total]
default value to work this out so i dont have to enter it. I've tried
entering things into the field/ properties/ defualt value, found on here but
cant get a good result. Should the field be a text box or a time field? that
has my table as its source? I want the Total lost time to be entered onto my
table also. Sorry if this seems simple but i'm a complete beginner. My table
is called LostMilesTBL if it helps.
  #2  
Old May 5th, 2008, 04:04 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Time calcuation in a form?

The Date/Time data type is used to display "point-in-time" information, not
"duration".

You'll need to use a text type control, and you'll need to build a parsing
routine.

Take a look at the DateDiff() function to find the difference (hint: use
"minutes"), then use your parsing routine to divide minutes by 60 (the
"hours" part) and the Mod() function (to find remainder--the "minutes" part)
and finally to concatenate them with the proper punctuation.

Regards

Jeff Boyce
Microsoft Office/Access MVP


"jackrobyn1" wrote in message
...
I have a form that has time fields [Timefrom] and [Timeto] and [Total]. The
times represent the period of time a vehicle was off the road. eg.
14:20pm -
15:35pm, should read 1:15 in the [Total] field, i want to set the [Total]
default value to work this out so i dont have to enter it. I've tried
entering things into the field/ properties/ defualt value, found on here
but
cant get a good result. Should the field be a text box or a time field?
that
has my table as its source? I want the Total lost time to be entered onto
my
table also. Sorry if this seems simple but i'm a complete beginner. My
table
is called LostMilesTBL if it helps.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:56 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.