UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Calculating Pace    
 
   
kmatt318
post Sep 22 2011, 03:49 PM
Post #1

UtterAccess Enthusiast
Posts: 61



I am having problems dividing time by distance.

The fields are:
Distance (double)
Time (short time)
Pace: =distance/time (short time)

It should output
Distance: 5
Time: 00:40:00
Pace: 00:08:00

Getting: 0:00

Please help.
Go to the top of the page
 
+
theDBguy
post Sep 22 2011, 03:55 PM
Post #2

Access Wiki and Forums Moderator
Posts: 47,901
From: SoCal, USA



Hi,

What version of Access are you using? If you are using a Date/Time data type to store the time, then you might have to reconsider. Date/Time data types are meant for "points in time" and not for "duration," which is what I think you want. For example, you can use a Long Integer type to store the value 40, and you won't have any problem dividing 5 with 40.

To display the result in a "time" format, you can use some calculations to convert the value into the correct format.

Just my 2 cents...
Go to the top of the page
 
+
kmatt318
post Sep 22 2011, 03:57 PM
Post #3

UtterAccess Enthusiast
Posts: 61



Using MS Access 2010.
Go to the top of the page
 
+
theDBguy
post Sep 22 2011, 03:58 PM
Post #4

Access Wiki and Forums Moderator
Posts: 47,901
From: SoCal, USA



QUOTE (kmatt318 @ Sep 22 2011, 01:57 PM) *
Using MS Access 2010.

Thanks. Just wanted to make sure there weren't any peculiarities with your Access version.
Go to the top of the page
 
+
vtd
post Sep 22 2011, 06:56 PM
Post #5

Retired Moderator
Posts: 19,667



QUOTE (kmatt318 @ Sep 23 2011, 06:49 AM) *
The fields are:
Distance (double)
Time (short time)
Pace: =distance/time (short time)

(short time)???

If I recall basic measurement study in primary school correctly then Pace (= Distance divided by Time) gives the speed and the unit of measurement for speed should be distance unit per (/) time unit such as miles/hour or m/minute. The unit of measurement for speed is never just time unit, e.g. "short time", AFAIK.

Thus, interpreting the resultant Pace value as time is certainly incorrect and may display unexpected value, e.g. or behaviour that you experienced...

Go to the top of the page
 
+
vtd
post Sep 22 2011, 08:09 PM
Post #6

Retired Moderator
Posts: 19,667



Did you mean to calculate the time it takes to travel one unit of length by any chance?

If yes, then I think the calculation should be time (duration) divided by distance and the unit of measurement would be time unit per (/) unit of length, e.g. minutes/mile, which is more like your description and the result is 8 minutes for each unit of distance given that it takes 40 minutes to travel the distance of 5 units of length.

Go to the top of the page
 
+
WildBird
post Sep 22 2011, 10:49 PM
Post #7

UtterAccess VIP
Posts: 3,050
From: Perth, Australia



Agree, you cant use date stamps for this, they need to be numbers. You can express the number later as hours/minutes/seconds etc, but only if you know what the number represents first, ie is it seconds elapsed, minutes elapsed, days?
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 08:10 AM