I have a number, 35.1519519, that I want to convert to degrees, minutes, and seconds. I know how to do this manually, but I wonder if there is a formula or a simple VBA script that will do it for me. I have a table that the number is in, and I will create the necessary fields in the table for deg, min, sec. Then I would use the formula in a form to divide the number into the necessary parts (I think).
but you need to write your own function, there may be one available on the web...
public function FormatPosition(sngPosition as single) as string
dim Degrees as integer
dim minutes as integer
dim Seconds as integer
degrees = int(sngposition)
minutes = int(sngposition*60)
formatposition = degrees & "º" & minutes & "'" & Seconds & "''"
thats not tested so I don't know if it will work
put the function into a module so it will be avaialble to any/all forms / reports etc.
you could extend the function by allowing a different format style
say ddd.dddddd, dddmm.mmmmm, ddd mm.mmmmmm, dd mm ss, or ddºmm'ss''
you coudl also allow the submission of different styles
I have a series of classes that were written for .NET dealing with navigational functions, which allows for this style of handling. The aim being to write a generalised class so it doesn't have to be revisited if there is a new input or output style