By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Adding Time

P: n/a
Hello:

Im not a professional programer in Access. Im working in a proyect
that will permit me add my flight time, but I have been having
problems with the time adding.

Please can some one gve me a clue to how i can add time that exceeds
24 hours (Eg. 500:47)

Thans a lot

Nicolas Mejia
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Nicolas

Don't use a Date data type for your field. This is for recording a specific
date/time, not an elapsed time. I suggest using a decimal data type and
entering your elapsed time as a fractional number (eg 1.5 hours) or as an
integer (eg 90 minutes). Get your users to enter it as 1.5 or 90 etc. If
necessary you may have to have it entered in two fields, hours and minutes
(e.g 1 hour and 30 minutes).

For reports, have a function for formatting it correctly. For example,
displaying 90 minutes as '1:30'.

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developers
www.asken.com.au

"Nicolas Mejia" <nm*****@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
Hello:

Im not a professional programer in Access. Im working in a proyect
that will permit me add my flight time, but I have been having
problems with the time adding.

Please can some one gve me a clue to how i can add time that exceeds
24 hours (Eg. 500:47)

Thans a lot

Nicolas Mejia

Nov 13 '05 #2

P: n/a
Hi all,
Like Nicolas, I am not a programmer but reading through the posts here
everyday, it seems that people can do pretty much anything they want with
the correct know-how and desire. It's been a long time since I was at school
so forgive me if I am not accurate but normal numbers are in base 10 (or
100) and time is in base 60? Is there not a way that the user can tell
Access to calculate a decimal data type in base 60?

Just a thought,

Mark

"Jeff" <je************@asken.com.au> wrote in message
news:Lq***************@news.optus.net.au...
Hi Nicolas

Don't use a Date data type for your field. This is for recording a specific date/time, not an elapsed time. I suggest using a decimal data type and
entering your elapsed time as a fractional number (eg 1.5 hours) or as an
integer (eg 90 minutes). Get your users to enter it as 1.5 or 90 etc. If
necessary you may have to have it entered in two fields, hours and minutes
(e.g 1 hour and 30 minutes).

For reports, have a function for formatting it correctly. For example,
displaying 90 minutes as '1:30'.

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developers
www.asken.com.au

"Nicolas Mejia" <nm*****@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
Hello:

Im not a professional programer in Access. Im working in a proyect
that will permit me add my flight time, but I have been having
problems with the time adding.

Please can some one gve me a clue to how i can add time that exceeds
24 hours (Eg. 500:47)

Thans a lot

Nicolas Mejia


Nov 13 '05 #3

P: n/a
As Jeff says don't use the Date function, try using the "\" and
"Mod" operators.

For example I have a form which shows music CD tracks; for each
track its length is entered as minutes and seconds in separate
fields. The query it is based on has a calculated field:

TrackLength: [tracklengthmin]*60+[tracklengthsec]

Total length is given in two controls on the form:

Minutes control source =Sum([tracklength])\60

Seconds control source =Sum([tracklength]) Mod 60

This isn't the same problem as yours but it could be modified to
give hours and minutes.

nm*****@hotmail.com (Nicolas Mejia) wrote:
Hello:

Im not a professional programer in Access. Im working in a proyect
that will permit me add my flight time, but I have been having
problems with the time adding.

Please can some one gve me a clue to how i can add time that exceeds
24 hours (Eg. 500:47)

Thans a lot

Nicolas Mejia


--
Graham
Nov 13 '05 #4

P: n/a
No. Not unless I have missed something here for a long time. But the code is
simple. This function below is air code but should work okay. You may want
to add error trapping.

Function FormatElapsedTime(plngTotalMins as long) as String

Dim lngHrs as Long, lngMns as Long, strTime as String

lngHrs = Int(plngTotalMins / 60)
lngMns = plngTotalMins Mod 60
strTime = Format(lngHrs, "00") & ":" & Format(lngMns, "00")

FormatElapsedTime = strTime

End Function

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developers
www.asken.com.au

"Mark Reed" <ma*********@ntlworld.com> wrote in message
news:2USzc.20$A74.9@newsfe1-win...
Hi all,
Like Nicolas, I am not a programmer but reading through the posts here
everyday, it seems that people can do pretty much anything they want with
the correct know-how and desire. It's been a long time since I was at school so forgive me if I am not accurate but normal numbers are in base 10 (or
100) and time is in base 60? Is there not a way that the user can tell
Access to calculate a decimal data type in base 60?

Just a thought,

Mark

"Jeff" <je************@asken.com.au> wrote in message
news:Lq***************@news.optus.net.au...
Hi Nicolas

Don't use a Date data type for your field. This is for recording a

specific
date/time, not an elapsed time. I suggest using a decimal data type and
entering your elapsed time as a fractional number (eg 1.5 hours) or as an integer (eg 90 minutes). Get your users to enter it as 1.5 or 90 etc. If
necessary you may have to have it entered in two fields, hours and minutes (e.g 1 hour and 30 minutes).

For reports, have a function for formatting it correctly. For example,
displaying 90 minutes as '1:30'.

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developers
www.asken.com.au

"Nicolas Mejia" <nm*****@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
Hello:

Im not a professional programer in Access. Im working in a proyect
that will permit me add my flight time, but I have been having
problems with the time adding.

Please can some one gve me a clue to how i can add time that exceeds
24 hours (Eg. 500:47)

Thans a lot

Nicolas Mejia



Nov 13 '05 #5

P: n/a
"Nicolas Mejia" <nm*****@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
Hello:

Im not a professional programer in Access. Im working in a proyect
that will permit me add my flight time, but I have been having
problems with the time adding.

Please can some one gve me a clue to how i can add time that exceeds
24 hours (Eg. 500:47)

You didn't give us any information about your table structure, but if you
are looking to calculate the number of hours or minutes between two
date/time values you need to use the DateDiff() function. :

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.