PMFJI,
I was playing around and came up with this function.
Lets say you have 3 unbound text boxes on a form.
In design view, name
the first text box "tbTheAngle"; change the label caption to "Angle"
the second text box "tbSine"; change the label caption to "Sine"
and the third text box "tbCosine"; change the label caption to "Cosine"
Paste the following function into a standard module:
Code:
Function GetSinCos(pTFunction As String, pdAngle As Double) As Double
Const dPi As Double = 3.14159265358979
Dim dRadians As Double
Dim dResult As Double
dResult = 0
'convert Degrees to Radians
dRadians = pdAngle * (dPi / 180)
Select Case pTFunction
Case "Sine"
'calc Sine
dResult = Sin(dRadians)
Case "Cosine"
'Calc Cosine
dResult = Cos(dRadians)
Case Else
MsgBox "Not Sine or Cosine"
End Select
GetSinCos = dResult
End Function
In the control source for the text box "tbSine", enter
=GetSinCos("Sine",[tbTheAngle])
In the control source for the text box "tbCosine", enter
=GetSinCos("Cosine",[tbTheAngle])
Switch the form to standard view and enter 30 into the top text box (tbAngle).
The value returned for the Sine should be 0.5
and the value for the Cosine should be 0.866025403784439