Ciao Bill
I just test it in a module
Public Sub test()
Dim x As Double
Dim a As Double
Dim b As Double
Dim varOut As Variant
a = 8
b = -80
x = a / b
varOut = x ^ 1.25
Debug.Print varOut
End Sub
and get same error 5 in line
varOut = x ^ 1.25
I work around then problem
...
a = 8
b = -80
x = a / b
if x < 0 then
varOut = abs(x) ^ 1.25
VarOut = -1 * varOut
else
varOut = x ^ 1.25
end if
I know is orribile but work!!
Ciao
Domenico
--- In MS_Access_Professionals@yahoogroups.com, "Bill Mosca" <wrmosca@...> wrote:
>
> Domenico
>
> I tested and got the same error. According to the help files in Access 2003:
> Syntax
> result = number^exponent
>
> A number can be negative only if exponent is an integer value. When more than one exponentiation is performed in a single expression, the ^ operator is evaluated as it is encountered from left to right.
>
> I don't know why it works using -0.1 ^ 1.25, but if you use variables you'll get err 5 even if you do it in steps like this:
> Dim x As Double
> Dim a As Double
> Dim b As Double
> Dim varOut As Variant
>
> a = 8
> b = -80
> x = a / b
> varOut = x ^ 1.25
> Debug.Print varOut
>
>
> Regards,
> Bill Mosca, Founder - MS_Access_Professionals
> http://www.thatlldoit.com
> Microsoft Office Access MVP
> https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
> My nothing-to-do-with-Access blog
> http://wrmosca.wordpress.com
>
>
>
>
> --- In MS_Access_Professionals@yahoogroups.com, "domcoz" <domcoz@> wrote:
> >
> > Hi Friends,
> >
> > I have a formula in a form like:
> >
> > (a / b) ^ 1.25
> >
> > a = 8
> > b = -80
> >
> > (8 / -80) ^ 1.25 give me error run-time '5'
> >
> > but -0.1 ^ 1.25 is ok
> >
> > why? ..
> >
> > Thanks
> > Domenico
> >
>
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (3) |
Tidak ada komentar:
Posting Komentar