We are more of a teaching to fish kind of forum than providing fish. So, what have you tried?
As general help--this is going to require you to write your own VBA function. You would pass it your 2 values, the function would do the calculation and return the value you want. The good news is, both those Excel functions do relatively simply math operations. Figuring out the logic shouldn't be too difficult, it will be the syntax that gives you issues.
First, Atn(x) is already an Access function. Be warned, however, that Arctangents can include infinity. Access, like any other computer in the world, really doesn't like infinity. How you handle infinities will be your problem.
Second, the Degrees function does not exist in Access but you could write a Public function in a General module and that function can be called in a query run from a DoCmd.RunSQL situation. The math is simple enough. If the proposed function would be available, Atn would be available in the same context.
Code:
Public Function ToDegrees( Rdns as Double) as Double
Dim X as Double
ToDegrees = Rdns * 180.0 / 3.141592653589793
End Function
Note also that this simplified version does not check for whether the angles are normalized in the range -pi to +pi, so if you put in an abominable number of radians, you will get an abominable number of degrees.
With this function, you could write "ToDegrees(Atn(A/B))" in a query and it should work as long as you don't care about those pesky infinities.
None are my own work - most of them came from http://www.devx.com/vb2themax/Tip/19024
The exception was the Atn2 function which I adapted from code for C# that I found somewhere else online
Code:
Option Compare Database
Option Explicit
'#####################################
'MISSING TRIG FUNCTIONS
'http://www.devx.com/vb2themax/Tip/19024
' arc sine
' error if value is outside the range [-1,1]
Function ASin(value As Double) As Double
If Abs(value) <> 1 Then
ASin = Atn(value / Sqr(1 - value * value))
Else
ASin = 1.5707963267949 * Sgn(value)
End If
End Function
' arc cosine
' error if NUMBER is outside the range [-1,1]
Function ACos(ByVal Number As Double) As Double
If Abs(Number) <> 1 Then
ACos = 1.5707963267949 - Atn(Number / Sqr(1 - Number * Number))
ElseIf Number = -1 Then
ACos = 3.14159265358979
End If
'elseif number=1 --> Acos=0 (implicit)
End Function
' arc cotangent
' error if NUMBER is zero
Function ACot(value As Double) As Double
ACot = Atn(1 / value)
End Function
' arc secant
' error if value is inside the range [-1,1]
Function ASec(value As Double) As Double
' NOTE: the following lines can be replaced by a single call
' ASec = ACos(1 / value)
If Abs(value) <> 1 Then
ASec = 1.5707963267949 - Atn((1 / value) / Sqr(1 - 1 / (value * value)))
Else
ASec = 3.14159265358979 * Sgn(value)
End If
End Function
' arc cosecant
' error if value is inside the range [-1,1]
Function ACsc(value As Double) As Double
' NOTE: the following lines can be replaced by a single call
' ACsc = ASin(1 / value)
If Abs(value) <> 1 Then
ACsc = Atn((1 / value) / Sqr(1 - 1 / (value * value)))
Else
ACsc = 1.5707963267949 * Sgn(value)
End If
End Function
Public Function Atn2(Y As Double, X As Double) As Double
'Arctangent of 2 values (lat/long)
If X > 0 Then
Atn2 = Atn(Y / X)
ElseIf X < 0 Then
Atn2 = Sgn(Y) * (Pi - Atn(Abs(Y / X)))
ElseIf Y = 0 Then
Atn2 = 0
Else
Atn2 = Sgn(Y) * Pi / 2
End If
End Function
First, Atn(x) is already an Access function. Be warned, however, that Arctangents can include infinity. Access, like any other computer in the world, really doesn't like infinity. How you handle infinities will be your problem.
Second, the Degrees function does not exist in Access but you could write a Public function in a General module and that function can be called in a query run from a DoCmd.RunSQL situation. The math is simple enough. If the proposed function would be available, Atn would be available in the same context.
Code:
Public Function ToDegrees( Rdns as Double) as Double
Dim X as Double
ToDegrees = Rdns * 180.0 / 3.141592653589793
End Function
Note also that this simplified version does not check for whether the angles are normalized in the range -pi to +pi, so if you put in an abominable number of radians, you will get an abominable number of degrees.
With this function, you could write "ToDegrees(Atn(A/B))" in a query and it should work as long as you don't care about those pesky infinities.
Due to a bug in the forum software this message was "unapproved" (hidden) for some considerable time. I have just approved it. I hope no one has been inconvenience too much! The new forum software no longer has this bug, so this problem should not reoccur.