BarryClark
New member
- Local time
- Today, 17:39
- Joined
- Aug 24, 2011
- Messages
- 5
I have a query in an access 2007 database that returns a numerical value for the cosine of an angle. I need to transform that value into the angle itself but there is no ArcCos function in Access.
I have created a new Module, which I named ArcCOS to do that but when I test it in the Immediate environment, it returns a Compile Error --- Expected Variable or Procedure, not Module.
The code for the Module I created is:
Option Compare Database
Public Function ArcCOS(ByVal nValue As Double, Optional fRadians As Boolean = True) As Double
Const PI As Double = 3.14159265359
ArcCOS = -Atn(nValue / Sqr(1 - nValue * nValue)) + PI / 2
If fRadians = False Then ArcCOS = ArcCOS * (PI / 180)
End Function
Can anyone tell me what I have got wrong?
I have created a new Module, which I named ArcCOS to do that but when I test it in the Immediate environment, it returns a Compile Error --- Expected Variable or Procedure, not Module.
The code for the Module I created is:
Option Compare Database
Public Function ArcCOS(ByVal nValue As Double, Optional fRadians As Boolean = True) As Double
Const PI As Double = 3.14159265359
ArcCOS = -Atn(nValue / Sqr(1 - nValue * nValue)) + PI / 2
If fRadians = False Then ArcCOS = ArcCOS * (PI / 180)
End Function
Can anyone tell me what I have got wrong?