Help with code (1 Viewer)

John K

Registered User.
Local time
Today, 09:10
Joined
Apr 13, 2013
Messages
11
Hello,
I am using access 2010 on windows 7. I am trying to create a form in visual basic express 2010 that I can use to input data into a table. I have that completed. The problem I am having is I have text boxed for a used to input in a decimal format latitude and longatude with a button. When the button is clicked I want to display on the form the distance in miles and also input that data into the table. Here is the problem I just need a simple formula and I am trying to use this
=ACOS(COS(RADIANS(90-Lat1)) *COS(RADIANS(90-Lat2)) +SIN(RADIANS(90-Lat1)) *SIN(RADIANS(90-Lat2)) *COS(RADIANS(Long1-Long2))) *6371​
The problem is visual basic does not have a math fuction for radians. How can I get around this problem with a simple formula.
Thank you for you help,
John
 

DJkarl

Registered User.
Local time
Today, 08:10
Joined
Mar 16, 2007
Messages
1,028
If you have the degrees you can use the formula (degrees * (PI/180)) = radians

PI is defined in the .NET Math class, Math.PI.
 

jdraw

Super Moderator
Staff member
Local time
Today, 09:10
Joined
Jan 23, 2006
Messages
15,379
You may also find info here
 

Users who are viewing this thread

Top Bottom