473,467 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Time grand total in MS-Access

I have a video tape library that we use at work here in a MS-Access
database.

When originally desgined, we never thought ot convert the time on the
fly into total seconds, but instead, we stored all of the times in
hh:nn:ss format - because that is the way we thought about things
around here, and which would make sense in our line of work.

Well, now I am being asked to run some statistics, and my boss wants
total time for created programming - meaning, he would like a sum of my
length field.

I have read some other postings saying to multiply my sum by 24.

Sum(length) * 24

However, I get a result of

370.699722222223

If I change the resulting format to hh:nn:ss, I get

16:47:36

Am I on the right track? Am I getting the correct result? HELP!?!

Jul 25 '06 #1
5 7101
si******@gmail.com wrote:
I have a video tape library that we use at work here in a MS-Access
database.

When originally desgined, we never thought ot convert the time on the
fly into total seconds, but instead, we stored all of the times in
hh:nn:ss format - because that is the way we thought about things
around here, and which would make sense in our line of work.

Well, now I am being asked to run some statistics, and my boss wants
total time for created programming - meaning, he would like a sum of my
length field.

I have read some other postings saying to multiply my sum by 24.

Sum(length) * 24

However, I get a result of

370.699722222223

If I change the resulting format to hh:nn:ss, I get

16:47:36

Am I on the right track? Am I getting the correct result? HELP!?!
Would the Second() function (see Help) work? This permits you to sum
the seconds.

Jul 25 '06 #2
si******@gmail.com wrote in
news:11**********************@m79g2000cwm.googlegr oups.com:
I have a video tape library that we use at work here in a
MS-Access database.

When originally desgined, we never thought ot convert the time
on the fly into total seconds, but instead, we stored all of
the times in hh:nn:ss format - because that is the way we
thought about things around here, and which would make sense
in our line of work.

Well, now I am being asked to run some statistics, and my boss
wants total time for created programming - meaning, he would
like a sum of my length field.

I have read some other postings saying to multiply my sum by
24.

Sum(length) * 24

However, I get a result of

370.699722222223

If I change the resulting format to hh:nn:ss, I get

16:47:36

Am I on the right track? Am I getting the correct result?
HELP!?!
I don't see any need for your output to be in days, so forget
the * 24..

About 2 years ago I created a pair of functions, sec2dur() and
dur2sec(), which convert the dd:hh:mm:ss format to seconds and
back again.

Feel free to modify it to suit your data.

Public function dur2sec( _
optional dd as integer = 0, _
optional hh as integer = 0, _
optional mm as integter= 0, _
optional ss as integer) as long

dur2sec = dd * 86400 + hh * 3600 + mm * 60 + ss

End Function


Public Function sec2dur(seconds As Long) As String
On Error Resume Next

Dim hrs As Long
Dim mins As Integer
Dim secs As Integer

hrs = Int(seconds / 3600)
mins = Int((seconds - (3600 * hrs)) / 60)
secs = seconds - (hrs * 3600 + mins * 60)

sec2dur = Format(hrs, "#,##0") & ":" _
& Format(mins, "00") & ":" _
& Format(secs, "00")

End Function

I originally wrote them to do a simulated EDL(1) in Access, so
they should be just what you want. convert your formatted
duration with seconds: dur2sec([fieldname]) in a query, sum the
seconds, then convert back with sec2dur([seconds]) .

(1) Edit Decision List. a database of each clip to be used in
creating a video program.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 25 '06 #3
Thank you for your quick replies. However, I should have indicated that
not noly am I complete novice, but I am also performing all of these
queries right in Access itself.

All I need is a grand total of the "length field" in one of my tables,
and it can be in hh:nn:ss format, but I guess that format is incapable
of giving me a total of 435:45:04, because it cuts off at 24 hours -
from what I have read...

That last posting threw me for a loop. Is there something I can do that
is a littl emore straight forward. All I need is a total.

Thank you all for the help!

Jul 26 '06 #4
"The House of Miguel" <si******@gmail.comwrote in
news:11**********************@p79g2000cwp.googlegr oups.com:
Thank you for your quick replies. However, I should have
indicated that not noly am I complete novice, but I am also
performing all of these queries right in Access itself.

All I need is a grand total of the "length field" in one of my
tables, and it can be in hh:nn:ss format, but I guess that
format is incapable of giving me a total of 435:45:04, because
it cuts off at 24 hours - from what I have read...

That last posting threw me for a loop. Is there something I
can do that is a littl emore straight forward. All I need is a
total.

Thank you all for the help!
you cannot get much more straightforward that the code posted and
still get the results you want.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 26 '06 #5
Bob Quintal wrote:
"The House of Miguel" <si******@gmail.comwrote in
news:11**********************@p79g2000cwp.googlegr oups.com:

>>Thank you for your quick replies. However, I should have
indicated that not noly am I complete novice, but I am also
performing all of these queries right in Access itself.

All I need is a grand total of the "length field" in one of my
tables, and it can be in hh:nn:ss format, but I guess that
format is incapable of giving me a total of 435:45:04, because
it cuts off at 24 hours - from what I have read...

That last posting threw me for a loop. Is there something I
can do that is a littl emore straight forward. All I need is a
total.

Thank you all for the help!

you cannot get much more straightforward that the code posted and
still get the results you want.

In a query, you can call a function like Bob's examples. If applying
within the query builder, enter something like
Expr1 : Sec2Dur(SecondsAmount)

Or you can use Dsum for a single value within some code
Dim strLen As String
Dim lngSecs As Long
'NZ used in case sum returns Null due to no finds
lngSecs = NZ(Dsum("Length","TableName","ID = 123"),0)
'convert the seconds value to a string
strLen = Sec2Dur(lngSecs)
...process further info

If you don't understand coding you might want to get a Microsoft
Step-By-Step book on the version of Access you are using.
Jul 26 '06 #6

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

Similar topics

5
by: Johannes Lebek | last post by:
Hi there, lately, I experienced a strange thing on my DB2 V8.1 on Windows: Some queries took a very long time. A snapshot discovered the following: Number of executions = 47...
3
by: CSDunn | last post by:
Hello, I have 14 fields on a report that hold integer values. The field names use the following naming convention: T1Number, T2Number ....T14Number. I need to get a 'sub total' of all fields as...
4
by: lyndsey | last post by:
i have a database to keep record of jobs in production, and on one of my forms, their is the control . in my form i have hundereds of records (jobs). is there a way i can create something in my...
6
by: Coleen | last post by:
Hi All :-) Thanks for all of your help Cor :-) I can not get the code you sent me to work in my application. I'm using an aspx datagrid in a web form. I'm getting the following error message...
3
by: rdudejr | last post by:
Hi all, Ive got a database approx 350 GB in which Im getting very high Time waited for prefetch. This is directly out of the snapshot for the db (these are for the entire database I assume as I...
17
by: barkarlo | last post by:
I need help to make grand total time in continuous forms. to calculate total work time I use following formula =format(+1--nz();"short time"). but when I make grand total time in form footer (for...
2
by: sammiesue | last post by:
Hi, I have form with 2 autosummed textboxes ("total" and "casinototal"). I would like to have a grand total textbox ("grandtotal") get its value from summing "total" and "casinototal", but it...
1
by: eogyamfi | last post by:
i have subreport within the main report. The grand total for the main report is showing on the report. The grandtotal for the subreport is not showing even though on the subreport itself it shows...
3
by: kkshansid | last post by:
how to get grand total of two years 2001,2002 are fields SELECT sum( 2001 ) AS "2001-2002", sum( 2002 ) AS "2002-2003", ( "2001-2002" + "2002-2003" ) AS "grand total" FROM school this query...
2
by: Bytesmiths | last post by:
I'm using GROUP BY to come up with totals for some items, but would like to either have a grand total at the bottom, or a running total field. I tried to use a variable as I found in several...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.