Full Version: Calculating Pace
UtterAccess Discussion Forums > Microsoft® Access > Access Tables + Relationships
kmatt318
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.
theDBguy
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...
kmatt318
Using MS Access 2010.
theDBguy
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.
vtd
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...

vtd
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.

WildBird
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?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.