J
Jim Ory
Using WinXP, Access2K2
In Microsoft Excel, slightly modified for Access, I found this formula to
calculate the
distance between two points on the earth, using latitude and longitude in
decimal degrees:
=((3443.917)*ACOS(Cos(90-([strLat])))*Cos(90-([MyLat]))+Sin(90-([strLat]))*Sin(90-([MyLat]))*Cos([strLong]-[MyLong]))*1.15078
(The last number converts nautical miles to standard miles.)
Access does not have an ArcCosine function, but found the following code on
another Access information site:
Function ACos(X As Double) As Double
' Arccos the same as ACOS in Excel
ACos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function
On another information site, a person recommended putting the previous code
in a Module.
This is where I'm totally lost. I understand there is a Standard module and
a Form module, but I don't know how to determine what to do with that.
I also don't understand how to get X into the Function. (I believe it is an
integer between 1 and -1). And how do I use the module in my formula?
Thanks in advance.
In Microsoft Excel, slightly modified for Access, I found this formula to
calculate the
distance between two points on the earth, using latitude and longitude in
decimal degrees:
=((3443.917)*ACOS(Cos(90-([strLat])))*Cos(90-([MyLat]))+Sin(90-([strLat]))*Sin(90-([MyLat]))*Cos([strLong]-[MyLong]))*1.15078
(The last number converts nautical miles to standard miles.)
Access does not have an ArcCosine function, but found the following code on
another Access information site:
Function ACos(X As Double) As Double
' Arccos the same as ACOS in Excel
ACos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function
On another information site, a person recommended putting the previous code
in a Module.
This is where I'm totally lost. I understand there is a Standard module and
a Form module, but I don't know how to determine what to do with that.
I also don't understand how to get X into the Function. (I believe it is an
integer between 1 and -1). And how do I use the module in my formula?
Thanks in advance.