Undefined Function 'ACOS' in Expression

G

Guest

i'm having a problem performing the following expression in an access (2000)
query that seems to work just fine in excel (2003). I get the error in the
suject header.
Expr1:
(3958.755866*ACOS((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+Sin((90-[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))

any suggestions are helpful
thanks
 
R

Roger Carlson

Access 2000 Help is blindly unhelpful here. It appears that ACOS is
supported, but it is not. It is actually giving Help for Excel, which you
don't need.

Since Access does not support ACOS, you will have to derive it. According
to Access 97 Help (which IS helpful), you can derive it by the following
formula:
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

I suggest you create a custom function called Arccos() that will calculate
it and return it to the Expression.

BTW, here are some other helpful derived functions from Access 97 Help:

Secant Sec(X) = 1 / Cos(X)
Cosecant Cosec(X) = 1 / Sin(X)
Cotangent Cotan(X) = 1 / Tan(X)
Inverse Sine Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Inverse Cosine Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
Inverse Secant Arcsec(X) = Atn(X / Sqr(X * X - 1)) + Sgn((X) - 1) * (2 *
Atn(1))
Inverse Cosecant Arccosec(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * (2 *
Atn(1))
Inverse Cotangent Arccotan(X) = Atn(X) + 2 * Atn(1)
Hyperbolic Sine HSin(X) = (Exp(X) - Exp(-X)) / 2
Hyperbolic Cosine HCos(X) = (Exp(X) + Exp(-X)) / 2
Hyperbolic Tangent HTan(X) = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
Hyperbolic Secant HSec(X) = 2 / (Exp(X) + Exp(-X))
Hyperbolic Cosecant HCosec(X) = 2 / (Exp(X) - Exp(-X))
Hyperbolic Cotangent HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
Inverse Hyperbolic Sine HArcsin(X) = Log(X + Sqr(X * X + 1))
Inverse Hyperbolic Cosine HArccos(X) = Log(X + Sqr(X * X - 1))
Inverse Hyperbolic Tangent HArctan(X) = Log((1 + X) / (1 - X)) / 2
Inverse Hyperbolic Secant HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X)
Inverse Hyperbolic Cosecant HArccosec(X) = Log((Sgn(X) * Sqr(X * X + 1) + 1)
/ X)
Inverse Hyperbolic Cotangent HArccotan(X) = Log((X + 1) / (X - 1)) / 2
Logarithm to base N LogN(X) = Log(X) / Log(N)

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
G

Guest

Thanks, thats what i figured the problem was after i got the same error for
"pi". your response, however, raises a second question. how do i create a
custom expression. do you mean, create the expression defining 'acos' first
and then create the second expression referencing the result of the 'acos'
expression for "acos"?

Roger Carlson said:
Access 2000 Help is blindly unhelpful here. It appears that ACOS is
supported, but it is not. It is actually giving Help for Excel, which you
don't need.

Since Access does not support ACOS, you will have to derive it. According
to Access 97 Help (which IS helpful), you can derive it by the following
formula:
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

I suggest you create a custom function called Arccos() that will calculate
it and return it to the Expression.

BTW, here are some other helpful derived functions from Access 97 Help:

Secant Sec(X) = 1 / Cos(X)
Cosecant Cosec(X) = 1 / Sin(X)
Cotangent Cotan(X) = 1 / Tan(X)
Inverse Sine Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Inverse Cosine Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
Inverse Secant Arcsec(X) = Atn(X / Sqr(X * X - 1)) + Sgn((X) - 1) * (2 *
Atn(1))
Inverse Cosecant Arccosec(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * (2 *
Atn(1))
Inverse Cotangent Arccotan(X) = Atn(X) + 2 * Atn(1)
Hyperbolic Sine HSin(X) = (Exp(X) - Exp(-X)) / 2
Hyperbolic Cosine HCos(X) = (Exp(X) + Exp(-X)) / 2
Hyperbolic Tangent HTan(X) = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
Hyperbolic Secant HSec(X) = 2 / (Exp(X) + Exp(-X))
Hyperbolic Cosecant HCosec(X) = 2 / (Exp(X) - Exp(-X))
Hyperbolic Cotangent HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
Inverse Hyperbolic Sine HArcsin(X) = Log(X + Sqr(X * X + 1))
Inverse Hyperbolic Cosine HArccos(X) = Log(X + Sqr(X * X - 1))
Inverse Hyperbolic Tangent HArctan(X) = Log((1 + X) / (1 - X)) / 2
Inverse Hyperbolic Secant HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X)
Inverse Hyperbolic Cosecant HArccosec(X) = Log((Sgn(X) * Sqr(X * X + 1) + 1)
/ X)
Inverse Hyperbolic Cotangent HArccotan(X) = Log((X + 1) / (X - 1)) / 2
Logarithm to base N LogN(X) = Log(X) / Log(N)

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

KevinJ said:
i'm having a problem performing the following expression in an access (2000)
query that seems to work just fine in excel (2003). I get the error in the
suject header.
Expr1:
(3958.755866*ACOS((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+Sin((90-
[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))

any suggestions are helpful
thanks
 
R

Roger Carlson

Sorry. No. Not a custom expression, a custom Function. In a general
module, create a function that looks like this:

Function Arccos(X as Double) As Double
Arccos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function

Then use YOUR Arccos exactly like you would use the ACOS.


Expr1:(3958.755866*Arccos((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+
Sin((90-[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))

Given that PI doesn't exist either (I didn't realise that), you will want to
create a Constant in Access too. In the same module (NOT in the function.
At the top of the MODULE) put:

Const PI As Double = 3.1416 (to whatever precision you want.)

You can also get rid of the parens after PI in your expression.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L



KevinJ said:
Thanks, thats what i figured the problem was after i got the same error for
"pi". your response, however, raises a second question. how do i create a
custom expression. do you mean, create the expression defining 'acos' first
and then create the second expression referencing the result of the 'acos'
expression for "acos"?

Roger Carlson said:
Access 2000 Help is blindly unhelpful here. It appears that ACOS is
supported, but it is not. It is actually giving Help for Excel, which you
don't need.

Since Access does not support ACOS, you will have to derive it. According
to Access 97 Help (which IS helpful), you can derive it by the following
formula:
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

I suggest you create a custom function called Arccos() that will calculate
it and return it to the Expression.

BTW, here are some other helpful derived functions from Access 97 Help:

Secant Sec(X) = 1 / Cos(X)
Cosecant Cosec(X) = 1 / Sin(X)
Cotangent Cotan(X) = 1 / Tan(X)
Inverse Sine Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Inverse Cosine Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
Inverse Secant Arcsec(X) = Atn(X / Sqr(X * X - 1)) + Sgn((X) - 1) * (2 *
Atn(1))
Inverse Cosecant Arccosec(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * (2 *
Atn(1))
Inverse Cotangent Arccotan(X) = Atn(X) + 2 * Atn(1)
Hyperbolic Sine HSin(X) = (Exp(X) - Exp(-X)) / 2
Hyperbolic Cosine HCos(X) = (Exp(X) + Exp(-X)) / 2
Hyperbolic Tangent HTan(X) = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
Hyperbolic Secant HSec(X) = 2 / (Exp(X) + Exp(-X))
Hyperbolic Cosecant HCosec(X) = 2 / (Exp(X) - Exp(-X))
Hyperbolic Cotangent HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
Inverse Hyperbolic Sine HArcsin(X) = Log(X + Sqr(X * X + 1))
Inverse Hyperbolic Cosine HArccos(X) = Log(X + Sqr(X * X - 1))
Inverse Hyperbolic Tangent HArctan(X) = Log((1 + X) / (1 - X)) / 2
Inverse Hyperbolic Secant HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X)
Inverse Hyperbolic Cosecant HArccosec(X) = Log((Sgn(X) * Sqr(X * X + 1) + 1)
/ X)
Inverse Hyperbolic Cotangent HArccotan(X) = Log((X + 1) / (X - 1)) / 2
Logarithm to base N LogN(X) = Log(X) / Log(N)

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

KevinJ said:
i'm having a problem performing the following expression in an access (2000)
query that seems to work just fine in excel (2003). I get the error
in
the
suject header.
Expr1:
(3958.755866*ACOS((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+Sin((90-
[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))
any suggestions are helpful
thanks
 
G

Guest

Roger, you've been such a big help that i wont blame you at all for not
responding. Arccos is defined but now i am prompted to input PI's value. this
is unlike the error i got before when it said "function undefined" this
actually runs and when i manually input "3.14159265358979" my results are
fine. this is how my module looks.

Option Compare Database
Const PI As Double = 3.14159265358979

Function Arccos (x As Double) As Double
Arccos = Atn(-x / Sqr(-x * x + 1))+2 * Atn(1)
End Function

Roger Carlson said:
Sorry. No. Not a custom expression, a custom Function. In a general
module, create a function that looks like this:

Function Arccos(X as Double) As Double
Arccos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function

Then use YOUR Arccos exactly like you would use the ACOS.


Expr1:(3958.755866*Arccos((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+
Sin((90-[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))

Given that PI doesn't exist either (I didn't realise that), you will want to
create a Constant in Access too. In the same module (NOT in the function.
At the top of the MODULE) put:

Const PI As Double = 3.1416 (to whatever precision you want.)

You can also get rid of the parens after PI in your expression.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L



KevinJ said:
Thanks, thats what i figured the problem was after i got the same error for
"pi". your response, however, raises a second question. how do i create a
custom expression. do you mean, create the expression defining 'acos' first
and then create the second expression referencing the result of the 'acos'
expression for "acos"?

Roger Carlson said:
Access 2000 Help is blindly unhelpful here. It appears that ACOS is
supported, but it is not. It is actually giving Help for Excel, which you
don't need.

Since Access does not support ACOS, you will have to derive it. According
to Access 97 Help (which IS helpful), you can derive it by the following
formula:
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

I suggest you create a custom function called Arccos() that will calculate
it and return it to the Expression.

BTW, here are some other helpful derived functions from Access 97 Help:

Secant Sec(X) = 1 / Cos(X)
Cosecant Cosec(X) = 1 / Sin(X)
Cotangent Cotan(X) = 1 / Tan(X)
Inverse Sine Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Inverse Cosine Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
Inverse Secant Arcsec(X) = Atn(X / Sqr(X * X - 1)) + Sgn((X) - 1) * (2 *
Atn(1))
Inverse Cosecant Arccosec(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * (2 *
Atn(1))
Inverse Cotangent Arccotan(X) = Atn(X) + 2 * Atn(1)
Hyperbolic Sine HSin(X) = (Exp(X) - Exp(-X)) / 2
Hyperbolic Cosine HCos(X) = (Exp(X) + Exp(-X)) / 2
Hyperbolic Tangent HTan(X) = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
Hyperbolic Secant HSec(X) = 2 / (Exp(X) + Exp(-X))
Hyperbolic Cosecant HCosec(X) = 2 / (Exp(X) - Exp(-X))
Hyperbolic Cotangent HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
Inverse Hyperbolic Sine HArcsin(X) = Log(X + Sqr(X * X + 1))
Inverse Hyperbolic Cosine HArccos(X) = Log(X + Sqr(X * X - 1))
Inverse Hyperbolic Tangent HArctan(X) = Log((1 + X) / (1 - X)) / 2
Inverse Hyperbolic Secant HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X)
Inverse Hyperbolic Cosecant HArccosec(X) = Log((Sgn(X) * Sqr(X * X + 1) + 1)
/ X)
Inverse Hyperbolic Cotangent HArccotan(X) = Log((X + 1) / (X - 1)) / 2
Logarithm to base N LogN(X) = Log(X) / Log(N)

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

i'm having a problem performing the following expression in an access
(2000)
query that seems to work just fine in excel (2003). I get the error in
the
suject header.
Expr1:

(3958.755866*ACOS((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+Sin((90-
[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))

any suggestions are helpful
thanks
 
R

Roger Carlson

<sound of hand slapping forehead>

I'm sorry. I goofed. You have to put the PI constant in a function too.
Something like this:

Const PIConst As Double = 3.14159265358979

Function PI() As Double
PI= PIConst
End Function

Notice I changed the constant to "PIConst" so that you can use PI as the
function name. It will read better in your expression that way. You also
have to add the parens back into the expression after PI (i.e.
....Cos((90-[y])*PI()/180)*...)

Another way to do it is to just put the pi value in the function:

Function PI() As Double
PI= 3.14159265358979
End Function

Although I prefer defining the constant. Then you can use it anywhere in
your code.

Sorry for the confusion.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L



KevinJ said:
Roger, you've been such a big help that i wont blame you at all for not
responding. Arccos is defined but now i am prompted to input PI's value. this
is unlike the error i got before when it said "function undefined" this
actually runs and when i manually input "3.14159265358979" my results are
fine. this is how my module looks.

Option Compare Database
Const PI As Double = 3.14159265358979

Function Arccos (x As Double) As Double
Arccos = Atn(-x / Sqr(-x * x + 1))+2 * Atn(1)
End Function

Roger Carlson said:
Sorry. No. Not a custom expression, a custom Function. In a general
module, create a function that looks like this:

Function Arccos(X as Double) As Double
Arccos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function

Then use YOUR Arccos exactly like you would use the ACOS.


Expr1:(3958.755866*Arccos((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+
Sin((90-[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))

Given that PI doesn't exist either (I didn't realise that), you will want to
create a Constant in Access too. In the same module (NOT in the function.
At the top of the MODULE) put:

Const PI As Double = 3.1416 (to whatever precision you want.)

You can also get rid of the parens after PI in your expression.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L



KevinJ said:
Thanks, thats what i figured the problem was after i got the same
error
for
"pi". your response, however, raises a second question. how do i create a
custom expression. do you mean, create the expression defining 'acos' first
and then create the second expression referencing the result of the 'acos'
expression for "acos"?

:

Access 2000 Help is blindly unhelpful here. It appears that ACOS is
supported, but it is not. It is actually giving Help for Excel,
which
you
don't need.

Since Access does not support ACOS, you will have to derive it. According
to Access 97 Help (which IS helpful), you can derive it by the following
formula:
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

I suggest you create a custom function called Arccos() that will calculate
it and return it to the Expression.

BTW, here are some other helpful derived functions from Access 97 Help:

Secant Sec(X) = 1 / Cos(X)
Cosecant Cosec(X) = 1 / Sin(X)
Cotangent Cotan(X) = 1 / Tan(X)
Inverse Sine Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Inverse Cosine Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
Inverse Secant Arcsec(X) = Atn(X / Sqr(X * X - 1)) + Sgn((X) - 1) * (2 *
Atn(1))
Inverse Cosecant Arccosec(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) -
1) *
(2 *
Atn(1))
Inverse Cotangent Arccotan(X) = Atn(X) + 2 * Atn(1)
Hyperbolic Sine HSin(X) = (Exp(X) - Exp(-X)) / 2
Hyperbolic Cosine HCos(X) = (Exp(X) + Exp(-X)) / 2
Hyperbolic Tangent HTan(X) = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
Hyperbolic Secant HSec(X) = 2 / (Exp(X) + Exp(-X))
Hyperbolic Cosecant HCosec(X) = 2 / (Exp(X) - Exp(-X))
Hyperbolic Cotangent HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
Inverse Hyperbolic Sine HArcsin(X) = Log(X + Sqr(X * X + 1))
Inverse Hyperbolic Cosine HArccos(X) = Log(X + Sqr(X * X - 1))
Inverse Hyperbolic Tangent HArctan(X) = Log((1 + X) / (1 - X)) / 2
Inverse Hyperbolic Secant HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X)
Inverse Hyperbolic Cosecant HArccosec(X) = Log((Sgn(X) * Sqr(X * X +
1)
+ 1)
/ X)
Inverse Hyperbolic Cotangent HArccotan(X) = Log((X + 1) / (X - 1)) / 2
Logarithm to base N LogN(X) = Log(X) / Log(N)

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

i'm having a problem performing the following expression in an access
(2000)
query that seems to work just fine in excel (2003). I get the
error
in
the
suject header.
Expr1:
(3958.755866*ACOS((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+Sin((90-
[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))

any suggestions are helpful
thanks
 
G

Guest

thanks again roger, i'll do that instead. so far i've had to resort to
putting the actual value of pi into my expression, you have been extremely
helpful.
kevin

Roger Carlson said:
<sound of hand slapping forehead>

I'm sorry. I goofed. You have to put the PI constant in a function too.
Something like this:

Const PIConst As Double = 3.14159265358979

Function PI() As Double
PI= PIConst
End Function

Notice I changed the constant to "PIConst" so that you can use PI as the
function name. It will read better in your expression that way. You also
have to add the parens back into the expression after PI (i.e.
....Cos((90-[y])*PI()/180)*...)

Another way to do it is to just put the pi value in the function:

Function PI() As Double
PI= 3.14159265358979
End Function

Although I prefer defining the constant. Then you can use it anywhere in
your code.

Sorry for the confusion.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L



KevinJ said:
Roger, you've been such a big help that i wont blame you at all for not
responding. Arccos is defined but now i am prompted to input PI's value. this
is unlike the error i got before when it said "function undefined" this
actually runs and when i manually input "3.14159265358979" my results are
fine. this is how my module looks.

Option Compare Database
Const PI As Double = 3.14159265358979

Function Arccos (x As Double) As Double
Arccos = Atn(-x / Sqr(-x * x + 1))+2 * Atn(1)
End Function

Roger Carlson said:
Sorry. No. Not a custom expression, a custom Function. In a general
module, create a function that looks like this:

Function Arccos(X as Double) As Double
Arccos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function

Then use YOUR Arccos exactly like you would use the ACOS.


Expr1:(3958.755866*Arccos((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+
Sin((90-[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))

Given that PI doesn't exist either (I didn't realise that), you will want to
create a Constant in Access too. In the same module (NOT in the function.
At the top of the MODULE) put:

Const PI As Double = 3.1416 (to whatever precision you want.)

You can also get rid of the parens after PI in your expression.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L



Thanks, thats what i figured the problem was after i got the same error
for
"pi". your response, however, raises a second question. how do i create a
custom expression. do you mean, create the expression defining 'acos'
first
and then create the second expression referencing the result of the 'acos'
expression for "acos"?

:

Access 2000 Help is blindly unhelpful here. It appears that ACOS is
supported, but it is not. It is actually giving Help for Excel, which
you
don't need.

Since Access does not support ACOS, you will have to derive it.
According
to Access 97 Help (which IS helpful), you can derive it by the following
formula:
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

I suggest you create a custom function called Arccos() that will
calculate
it and return it to the Expression.

BTW, here are some other helpful derived functions from Access 97 Help:

Secant Sec(X) = 1 / Cos(X)
Cosecant Cosec(X) = 1 / Sin(X)
Cotangent Cotan(X) = 1 / Tan(X)
Inverse Sine Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Inverse Cosine Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
Inverse Secant Arcsec(X) = Atn(X / Sqr(X * X - 1)) + Sgn((X) - 1) * (2 *
Atn(1))
Inverse Cosecant Arccosec(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) *
(2 *
Atn(1))
Inverse Cotangent Arccotan(X) = Atn(X) + 2 * Atn(1)
Hyperbolic Sine HSin(X) = (Exp(X) - Exp(-X)) / 2
Hyperbolic Cosine HCos(X) = (Exp(X) + Exp(-X)) / 2
Hyperbolic Tangent HTan(X) = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
Hyperbolic Secant HSec(X) = 2 / (Exp(X) + Exp(-X))
Hyperbolic Cosecant HCosec(X) = 2 / (Exp(X) - Exp(-X))
Hyperbolic Cotangent HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
Inverse Hyperbolic Sine HArcsin(X) = Log(X + Sqr(X * X + 1))
Inverse Hyperbolic Cosine HArccos(X) = Log(X + Sqr(X * X - 1))
Inverse Hyperbolic Tangent HArctan(X) = Log((1 + X) / (1 - X)) / 2
Inverse Hyperbolic Secant HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X)
Inverse Hyperbolic Cosecant HArccosec(X) = Log((Sgn(X) * Sqr(X * X + 1)
+ 1)
/ X)
Inverse Hyperbolic Cotangent HArccotan(X) = Log((X + 1) / (X - 1)) / 2
Logarithm to base N LogN(X) = Log(X) / Log(N)

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

i'm having a problem performing the following expression in an access
(2000)
query that seems to work just fine in excel (2003). I get the error
in
the
suject header.
Expr1:


(3958.755866*ACOS((Cos((90-[y])*PI()/180)*Cos((90-[lat1])*PI()/180)+Sin((90-
[y])*PI()/180)*Sin((90-[y])*PI()/180)*Cos(([x]-[lon1])*PI()/180))))

any suggestions are helpful
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top