J
Jose Ruben Gonzalez-Baird
I tried posting this earlier, but it doesn't look like it posted properly.
Sorry for any redundancy.
I am trying to create two buttons on a form in access that will convert XY
coordinate values. One will convert from decimal degrees (DD) to degrees
minutes seconds (DMS), the other will convert from DMS to DD.
There will be four fields on the form tied to a registration table: X_DD,
Y_DD, X_DMS & Y_DMS. The format of the DD entries will be (I'm thinking)
double (will single work?) with precision up to 6 decimal places. The format
of the DMS entries will be DDD MM SS.S (where D=degrees, M=minutes, and
S=Seconds, precise to one decimal place.
If a user enters XY data in either format I want each button to be able to
convert to the other format. Is a macro the best way to do this? I have a
fairly okay idea on how to goe from DMS to DD using the following code:
Dim Degrees as Double
Dim Minutes as Double
Dim Seconds as Double
Dim DMS as Variant
Dim DD as Double
DMS = Split([Latitude])
Degrees = CDbl(DMS(0))
Minutes = CDbl(DMS(1))
Seconds = CDbl(DMS(2))
DD = (Seconds/3600) + (Minutes/60)+ Degrees
but I'm not sure how to go back the other way and get the DMS into the
proper format. Also, i'm not sure how to actually get this code into the
macro itself--i understand how to open a mnew macro in design view and
specify a list of commands, but i don't know where i would execute this code
and how to tie it calcs to the field in my table. If anyone could help me it
would be greatly appreciated. Thanks, Ruben.
Sorry for any redundancy.
I am trying to create two buttons on a form in access that will convert XY
coordinate values. One will convert from decimal degrees (DD) to degrees
minutes seconds (DMS), the other will convert from DMS to DD.
There will be four fields on the form tied to a registration table: X_DD,
Y_DD, X_DMS & Y_DMS. The format of the DD entries will be (I'm thinking)
double (will single work?) with precision up to 6 decimal places. The format
of the DMS entries will be DDD MM SS.S (where D=degrees, M=minutes, and
S=Seconds, precise to one decimal place.
If a user enters XY data in either format I want each button to be able to
convert to the other format. Is a macro the best way to do this? I have a
fairly okay idea on how to goe from DMS to DD using the following code:
Dim Degrees as Double
Dim Minutes as Double
Dim Seconds as Double
Dim DMS as Variant
Dim DD as Double
DMS = Split([Latitude])
Degrees = CDbl(DMS(0))
Minutes = CDbl(DMS(1))
Seconds = CDbl(DMS(2))
DD = (Seconds/3600) + (Minutes/60)+ Degrees
but I'm not sure how to go back the other way and get the DMS into the
proper format. Also, i'm not sure how to actually get this code into the
macro itself--i understand how to open a mnew macro in design view and
specify a list of commands, but i don't know where i would execute this code
and how to tie it calcs to the field in my table. If anyone could help me it
would be greatly appreciated. Thanks, Ruben.