Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2007

    Unanswered: Number Conversion

    I am using Access 2002.

    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).

    Has anyone done this before?

    Thanks for your help

  2. #2
    Join Date
    Apr 2004
    Kingsland, Georgia

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    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 & "''"
    exit function

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts