M
margieinWY
Guest
I am trying to convert latitude and longitude coordinates from decimal degrees to DDMMSS(Degrees, Minutes, Seconds) through the "on exit" event procedure in a form.
I have a table with columns:
latitude - holds decimal lat
longitude - holds decimal lon
dlat - holds the converted ddmmss lat
dlon - holds the converted dddmmsslon
I have tried the following formula BUT, I think that I am using "int" incorrectly in the "sec" definition. (The "min" function gives me the proper number but the 1st "sec" function gives me "00".) I need to get just the decimal part of the "min" and instead of using int is there anything else that will round the number?
Private Sub LATITUDE_EXIT(Cancel As Integer)
Dim Deg, Min, Sec As Integer
' Get the Degrees
Deg = Int(LATITUDE)
' Get the Minutes
Min = (LATITUDE - Deg) * 60
' Get the Seconds and make sure to round
Sec = Min - (Int(Min))
Sec = Int((Sec * 60) + 0.5)
' Put them together and store in DLAT
DLAT = (Deg * 10000) + (((int(Min)) * 100) + Sec
End Sub
All of the fields in the table and form are "double, fixed, at 6 decimal places."
If anyone has a clue I would greatly appreciate any help ... be careful though, the more you think about it, the more confused this equation seems
.
Thanks in advance...
MARGE
I have a table with columns:
latitude - holds decimal lat
longitude - holds decimal lon
dlat - holds the converted ddmmss lat
dlon - holds the converted dddmmsslon
I have tried the following formula BUT, I think that I am using "int" incorrectly in the "sec" definition. (The "min" function gives me the proper number but the 1st "sec" function gives me "00".) I need to get just the decimal part of the "min" and instead of using int is there anything else that will round the number?
Private Sub LATITUDE_EXIT(Cancel As Integer)
Dim Deg, Min, Sec As Integer
' Get the Degrees
Deg = Int(LATITUDE)
' Get the Minutes
Min = (LATITUDE - Deg) * 60
' Get the Seconds and make sure to round
Sec = Min - (Int(Min))
Sec = Int((Sec * 60) + 0.5)
' Put them together and store in DLAT
DLAT = (Deg * 10000) + (((int(Min)) * 100) + Sec
End Sub
All of the fields in the table and form are "double, fixed, at 6 decimal places."
If anyone has a clue I would greatly appreciate any help ... be careful though, the more you think about it, the more confused this equation seems
Thanks in advance...
MARGE