473,699 Members | 2,338 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 5583
"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
4743
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
7430
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
14977
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
4004
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
4217
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
2954
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
4240
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
2962
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
3594
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
8617
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8914
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
7751
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
6534
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
5875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
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

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.