p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: start time end time total time used help


Message #1 by "Clive Walker" <aces_hangout@h...> on Mon, 17 Jun 2002 13:57:13
Hi please can you help me with a problem.

I am quite new to access 2000 but have managed to set up a database
to add users for the computer section in my local library,
the problem is that I have a field for time started and a field for time 
finished, I also have a field for total time used, all of these fields 
have to be typed in manually which is ok for time started and time finished
but how can I get the total time used field to calculate the total time 
used from these two fields.

I hope I am making sense
Thanks in advance.
Message #2 by "Duncan" <duncan.faulkner1@b...> on Mon, 17 Jun 2002 14:50:52 +0100
Hi

Try using the datediff function, I think that's allowed in access VBA,
certainly works in VB you might have to concatenate the hours, minutes,
seconds as you can only do one at a time ie "h"=hours, "m" = minutes & "s" 
seconds.

Duncan

-----Original Message-----
From: Clive Walker [mailto:aces_hangout@h...]
Sent: 17 June 2002 13:57
To: Access
Subject: [access] start time end time total time used help


Hi please can you help me with a problem.

I am quite new to access 2000 but have managed to set up a database
to add users for the computer section in my local library,
the problem is that I have a field for time started and a field for time
finished, I also have a field for total time used, all of these fields
have to be typed in manually which is ok for time started and time finished
but how can I get the total time used field to calculate the total time
used from these two fields.

I hope I am making sense
Thanks in advance.

Message #3 by "Amy Wyatt" <amyw@c...> on Mon, 17 Jun 2002 18:32:21
I am assuming you are using text boxes for the entry. A couple of things. 
First, you can automatically enter the time (date/time) with the Now() 
function. Second if you format the text boxes to a date/time format then 
you can simply subtract them to get the time elapsed.

Be warned, this is a very simplistic solution. Now() includes seconds so 
if you have them entering an end time you may not get exactly what you 
expect when you subtract them. It would be best if you use Now() to enter 
the start time you would want to use Now() to enter the end time (via a 
command button for Logging out or something) then you will get an accurate 
result from subtracting the two times.

If you are not planning on anyone going over midnight (i.e. start 6/15/02 
11:00 pm, End 6/16/02 12:35 am) then you can just enter the time and 
subtract to get the hours and minutes.

If you need examples of this in code, let me know and I will send it to 
you with an explination of how to do this.

Hope this helps,

Amy

> Hi please can you help me with a problem.

> I am quite new to access 2000 but have managed to set up a database
t> o add users for the computer section in my local library,
t> he problem is that I have a field for time started and a field for time 
f> inished, I also have a field for total time used, all of these fields 
h> ave to be typed in manually which is ok for time started and time 
finished
b> ut how can I get the total time used field to calculate the total time 
u> sed from these two fields.

> I hope I am making sense
T> hanks in advance.
Message #4 by "Wesley Kendrick" <wez.k@n...> on Mon, 17 Jun 2002 22:43:53 +0100
Hi, try this.
Open the property sheet for the total time field, and type this into the
data section
= [time finished field name] - [time started field name]
Hope this helps, regards, Wesley Kendrick

----- Original Message -----
From: "Clive Walker" <aces_hangout@h...>
To: "Access" <access@p...>
Sent: Monday, June 17, 2002 1:57 PM
Subject: [access] start time end time total time used help


> Hi please can you help me with a problem.
>
> I am quite new to access 2000 but have managed to set up a database
> to add users for the computer section in my local library,
> the problem is that I have a field for time started and a field for time
> finished, I also have a field for total time used, all of these fields
> have to be typed in manually which is ok for time started and time
finished
> but how can I get the total time used field to calculate the total time
> used from these two fields.
>
> I hope I am making sense
> Thanks in advance.
>


  Return to Index