J
Jose Ruben Gonzalez-Baird
Hi,
I can't make out what's wrong with my code. I'm trying to code a button that
will convert a value from one field in a form to a degrees minutes seconds
value in another field on the form. When I tie the following code into a
button, I get an error: "Compile error:Expected End Sub".
Private Sub Convert_DD_to_DMS_Click()
Function DegToDMSStr(ByVal L As Double) As String
'
' Converts a decimal value to Degrees, Minutes, and Seconds
' Processes Seconds up to 3 decimal places.
' e.g. 15.5 -> 15 30' 0"
'
Dim D As Integer, M As Integer, S As Double
D = Int(L)
L = (L - D) * 60
M = Int(L)
S = Val(Format((L - M) * 60, "#.###"))
Me.[Latitude_DMS] = D & " " & M & "' " & S & """"
End Function
End Sub
I can't make out what's wrong with my code. I'm trying to code a button that
will convert a value from one field in a form to a degrees minutes seconds
value in another field on the form. When I tie the following code into a
button, I get an error: "Compile error:Expected End Sub".
Private Sub Convert_DD_to_DMS_Click()
Function DegToDMSStr(ByVal L As Double) As String
'
' Converts a decimal value to Degrees, Minutes, and Seconds
' Processes Seconds up to 3 decimal places.
' e.g. 15.5 -> 15 30' 0"
'
Dim D As Integer, M As Integer, S As Double
D = Int(L)
L = (L - D) * 60
M = Int(L)
S = Val(Format((L - M) * 60, "#.###"))
Me.[Latitude_DMS] = D & " " & M & "' " & S & """"
End Function
End Sub