473,388 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

How to Average time in MS Access 2003

I need to Average time data that has been entered. What do I need to do in the query?
Dec 26 '13 #1
13 6970
Rabbit
12,516 Expert Mod 8TB
Use the average function: Avg().
Dec 26 '13 #2
I know that. But when I Avg date/time entries I get a very low number (0.291666666666667). is there something I need to put in the criteria to make it show correctly?
Dec 26 '13 #3
Rabbit
12,516 Expert Mod 8TB
Use CDate() to convert the number to a date time value.
Dec 26 '13 #4
zmbd
5,501 Expert Mod 4TB
You need to be more specific as to how your data is being entered.
Say I Work from 8am to 4pm every day I average 8 hours a day; however, to calculate that information depends on how the information is stored in the data tables. If it is simply stored in a field type cast numeric(double) 8.0 then you can simply use an agregate query to do the average. However, if you are storing the information in date/time fields then you need to calculate the time difference and then the average.

This sounds very much like a homework question, we try not to provide code for such; thus, you will need to post you SQL either for the calculated field or the entire SQL script.

Please remember to format such script using the [CODE/] button.
(^_^)
Dec 26 '13 #5
NeoPa
32,556 Expert Mod 16PB
Converting the form of the data (Using CDate()) does nothing to the data itself (in this case), but it will have the effect of telling the SQL engine to change the default format of the data to a date/time based one. Although this (or something very similar) can also be achieved by using the Format property of the column, or even the Format() function itself, these other approaches have limitations in some scenarios.

What you are seeing is that date/time data is being passed into the Avg() function but as the return value for this function is not, itself, defined as date/time, the SQL engine treats it as a general number.
Dec 26 '13 #6
so is there anyway to avg a series of time data? data inputed as date/time. I am inputing the actual time a task is started and then in another field the time it was finished. So we want to avg all the start times and avg all the finished times.
Dec 26 '13 #7
Rabbit
12,516 Expert Mod 8TB
Use DateDiff to calculate the different in minutes between the two tasks and then average that value. That will give you the average number of minutes it took to complete a task.
Dec 26 '13 #8
I dont need to calculate the avg number of minutes it takes to do the task. We are calcuating the average of the actual time.

for example 12/1 7:00am
12/2 7:15am
12/3 7:20am
12/4 7:00am

then figure out what the avg time for those 4 values.
Dec 26 '13 #9
zmbd
5,501 Expert Mod 4TB
So you want what?
07:09 AM
or 9 minutes
or what?
Dec 26 '13 #10
7:09 AM is what I am looking for
Dec 26 '13 #11
zmbd
5,501 Expert Mod 4TB
And this is a beautiful homework question.

Rabbit in post #8 has the first part of the answer for you.

Once you have the average elapsed minutes then add that to the root time (lowest hour)

Please post your code/SQL, if you would, kindly format the posted script using the [CODE/] button.
Dec 26 '13 #12
Rabbit
12,516 Expert Mod 8TB
If you want an average starting time, then you will need to 0 out the integer part of the date so that it all starts on the same date with only the time varying. Then you can take the average of that.

You want to 0 out the interger part of a date because the a date is stored as a decimal with the fraction representing time and the integer representing number of days elapsed.
Dec 26 '13 #13
NeoPa
32,556 Expert Mod 16PB
Another way to do that is to use TimeValue() of the start date/times within the Avg() function call.

NB. It would have been much easier to give a proper answer to your question right from the off if you'd taken the effort to ask your question properly at the start. Your first post was not even half of the story we subsequently learned. Please do not follow this pattern in future questions. If so, they are likely to be deleted immediately before so many people's time is wasted on getting to the point that should be the start point.
Dec 26 '13 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: GregM | last post by:
Hi, I'm hoping that someone can point me in the right direction with this. What I would like to do is calculate the average time it takes to load a page. I've been searching the net and reading...
13
by: Noesis Strategy | last post by:
When I ordered my new laptop, Sony didn't offer Access 2003 in its bundles. Recently, I have begun to design Access databases using an copy of Access 2002 from my previous laptop. It works fine,...
28
by: Neil Ginsberg | last post by:
I have a client who is using Access 2002/2000 (the database itself is written in 2000), and is considering migrating to Access 2003. Any recommendations on whether Access 2003 is worth the migrate,...
10
by: Lauren Wilson | last post by:
Ok I have searched the MS website for info on this. I am totally confused. If I want to deploy an Access 2003 app and allow my users to run it using Access 2003 Runtime, where do I get the...
49
by: Mell via AccessMonster.com | last post by:
I created databases on Access 2003 and I want to deploy them to users. My code was also done using 2003. If they have Ms Access 2000 or higher, will they be able to use these dbs with all code,...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
9
by: Paul H | last post by:
As I understand it, to distribute a runtime version of Access 2003 with my app I need to spend £600 on "Visual Studio Tools for Office System package" which contains the RT plus a load of stuff I...
3
by: Sheldon | last post by:
I have the following query expression - Like Format((!!)) & "/*/" & (! !) which would translate to e.g. 04/*/2007 if someone is running a report for last month. The above expression is part of a...
9
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd...
5
by: p3rk3le | last post by:
So, I'm about to do a sequential search on a table (n contents) of random numbers. I have to print the average between the number of comparisons and the contents of the table (n) and the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
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,...
0
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...

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.