473,748 Members | 2,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding up hours and minutes problem

Hi Folks,

We have a form that records flight times in hours and minutes, for example a
1 hour 15 minute flight is recorded as 1:15 Does anyone know how to get
Access 2003 to calculate a total figure for a number of flight times
recorded in a datasheet form? and is there a way to display flight times
greater than 24 hours i.e 26:20 for example? The only solution i can find is
to use decimal times i.e 1.25 instead of 1:15 which is our least preferred
solution.

Many thanks

Nige
Feb 20 '07 #1
3 5584
"Nigel Heald" <ni***@mrauk.co .ukwrote in
news:12******** *****@corp.supe rnews.com:
Hi Folks,

We have a form that records flight times in hours and minutes, for
example a 1 hour 15 minute flight is recorded as 1:15 Does anyone know
how to get Access 2003 to calculate a total figure for a number of
flight times recorded in a datasheet form? and is there a way to
display flight times greater than 24 hours i.e 26:20 for example? The
only solution i can find is to use decimal times i.e 1.25 instead of
1:15 which is our least preferred solution.

Many thanks

Nige
You could write User Defined Functions. Here are a couple, thoroughly
untested, that might be a start:

Sub temp()
Debug.Print TimetoMinutes(" 1:15") + TimetoMinutes(" 23:00")
End Sub

Public Function HoursandMinutes $(ByVal vNinutes As Date)
Dim DateZero As Date
Dim Ninutes&
DateZero = DateSerial(1899 , 12, 30)
Ninutes = DateDiff("n", DateZero, vNinutes)
HoursandMinutes = CStr(Ninutes \ 60) & ":" & CStr(Ninutes Mod 60)
End Function

Public Function TimetoMinutes#( ByVal vTime$)
' vtime must be in format #0:00
TimetoMinutes = CDbl(Replace(vT ime, ":", "."))
End Function
Feb 20 '07 #2
See:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Nigel Heald" <ni***@mrauk.co .ukwrote in message
news:12******** *****@corp.supe rnews.com...
Hi Folks,

We have a form that records flight times in hours and minutes, for example
a 1 hour 15 minute flight is recorded as 1:15 Does anyone know how to get
Access 2003 to calculate a total figure for a number of flight times
recorded in a datasheet form? and is there a way to display flight times
greater than 24 hours i.e 26:20 for example? The only solution i can find
is to use decimal times i.e 1.25 instead of 1:15 which is our least
preferred solution.

Many thanks

Nige
Feb 20 '07 #3
Nigel

Had a quick go at this.
I think you will need to have the "flight time" field as a text type to
accomadate the +24 time flights.
You can then use CDbl(Left("Flig ht Time",2)) to convert the hours and
CDbl(Mid("Fligh t Time",4,2) to convert the minutes.
Get the complete total of minutes and divide by 60 to get the total hours.
Get the remainder and times by 60 to get the total minutes (or times by 6 if
you dont use the decimal).
However I started running into problems when the number of hours was more
than two digits long as it messes up the Left and Mid functions. Would be
easier if there is a way to detect the ":".

Sorry if this hasn't helped, lol.

Thanks
Paul

"Nigel Heald" <ni***@mrauk.co .ukwrote in message
news:12******** *****@corp.supe rnews.com...
Hi Folks,

We have a form that records flight times in hours and minutes, for example
a 1 hour 15 minute flight is recorded as 1:15 Does anyone know how to get
Access 2003 to calculate a total figure for a number of flight times
recorded in a datasheet form? and is there a way to display flight times
greater than 24 hours i.e 26:20 for example? The only solution i can find
is to use decimal times i.e 1.25 instead of 1:15 which is our least
preferred solution.

Many thanks

Nige

Feb 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4745
by: Nicolas Mejia | last post by:
Hello: I´m not a professional programer in Access. I´m 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
1
7439
by: serge | last post by:
Right now the database I am working with is storing time in an Integer data type and is storing the time value in seconds. The application does not allow entering seconds. It accepts minutes and hours. I have a report where it is doing: SELECT SUM(TIMEENTERED) and the SUM is *blowing* up as the SUM is reaching
22
14998
by: Drum2001 | last post by:
I have a table that tracks employee times. I have a column (Date/Time). Users, through a form, enter how long it takes them to complete a task. For example, 03:45 = 3 hours and 45 mins. I am running the following query: SELECT Sum(Nz(.,0)) AS SumOfNumberOfCompletions, Format(Sum(Nz(.,0)),"Short
8
4009
by: King | last post by:
Hi I have following MS Acess query Here is the query ID Name Prgm ID Client ID Date Start Time End Time Minutes C4 Trisha TIP DEK0703 7 /7 /2006 10:00:00 AM 12:00:00 PM 120
1
4232
by: baneaic | last post by:
I'm trying to create a form that will allow a user to enter certain job specifications (# of pages and # of copies) and then have a field that will automatically calculate how long that job will take to run (on a machine which runs at a given number of copies per minute). I have seen very short, control source statement that will format to hours:minutes, but I do not know how to make it format to days:hours:minutes, and most of the jobs...
1
2956
by: Nigel Heald | last post by:
Hi Folks, We have a form that records flight times in hours and minutes, for example a 1 hour 15 minute flight is recorded as 1:15 Does anyone know how to get Access 2003 to calculate a total figure for a number of flight times recorded in a datasheet form? and is there a way to display flight times greater than 24 hours i.e 26:20 for example? The only solution i can find is to use decimal times i.e 1.25 instead of 1:15 which is our...
6
4241
by: richbneal | last post by:
I really like the site so far and this is my first post. I have looked through some of the archives with no luck. I have also read the posting guidelines and will do my best to be clear and accurate with my problem. I am working with Access 2k / Win 2k. I have some experience and must have this figured out before Aug1. What i am tasked with is to modify an existing process that calculates the hours and minutes worked, which is entered on a...
8
2965
Dököll
by: Dököll | last post by:
All it is, is a simple program that asks to enter hour and minute and makes the clock tick, after ticking, when clock is viewed, it should read a minute ahead. Very proud of the results. The only issue is getting PM to fire when time ticks beyond 24 hours. Just a matter of time, but do tell me what you see happening, I am sure it is pretty simple... /** * @author Michael Kölling and David J. Barnes * @version 2007.10.03 *...
1
3596
by: George | last post by:
Hello........I have a problem adding up record entries with more than 24 hours when the fields are formatted as hour/minute (h:m). If the actual summed total of all records is greater than 24 hours, then the hour part of the answer is truncated to a number less than 24 based on however many multiples of 24 were part of the summed answer (clear as mud?). I anticipate the soulution involves either formatting the time field in a manner that...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.