Link to home
Start Free TrialLog in
Avatar of Srsystemanalyst
Srsystemanalyst

asked on

Error Type: Microsoft VBScript runtime (0x800A0006) Overflow

Hello Experts,

I am suddenly getting the error "Microsoft VBScript runtime (0x800A0006) Overflow" when I run an ASP generated report I am working on. I don not know why the error is occurring.

I am getting the error in the following line:

If MiscPwkTotal <> "" Then Response.Write "<td><font size=2>" & MiscPwkTotal & "</font><font color=red size=2>&nbsp;&nbsp;" & (FormatPercent((CDbl(MiscDiscTotal)/CDbl(MiscPwkTotal)),2)) & "</font></td></tr>" Else Response.Write "<td><font size=2>0</font></td></tr>"

I writing the select query for both at the top I have calculated like this:

MiscPwkTotal = MiscPwkTotal + CDbl(oRst(0))

and for MiscDiscTotal I have declared at the query like this:
      MiscDiscTotal = MiscDiscTotal + Cint(oRst(0))

ANy suggestions please..........

Thanks a lot for all your help.........
Avatar of golfDoctor
golfDoctor

Overflow means, usually, the value you tried to convert was too much for the datatype.

Meaning oRst(0), if a real number (and not null), was too big for CINT() function to handle.  Change to Clng() of Cdbl().

Forget the IS NULL part, that would be a different error.  So, most likely the number is too big for CINT().
FormatPercent((CDbl(MiscDiscTotal)/CDbl(MiscPwkTotal)),2)

^ This is causing the error.

Check the values of MiscDiscTotal and MiscPwkTotal
Overflow would also occur from divide by 0, meaning MiscPwkTotal is 0
Avatar of Patrick Matthews
BTW, you should probably not use the Integer data type at all.  Use Long instead (and thus CLng()
instead of CInt() ).

Integer tops out at ~ 32,767 vs ~2.1 billion.  Also, at runtime nearly every Integer value is being
implicitly converted to Long and then back to Integer whenever a logical or arithmetic operation
is being performed, so even though using Integer would seem to commit less memory, it can
actually slow down execution.

Patrick
Avatar of Srsystemanalyst

ASKER

Thanks a lot for all your advices.........

I will get bak to u once I implement it n let you know the result..........
It didn't work for me.......I changed to CLong from Cint........But it didn't work I am getting the same error......
I mean changed to Clng from Cint...........

It didn't work for me........
Any help please.........
As mentioned, you may be dividing by zero.  Make sure you are not.
Nopes......I m not divinding by zero.........

In MiscPwkTotal I hve a value of 474092 and in MiscDiscTotal I have a value of 792....
When I executed the query I got the values likes this...........

Thanks for all your help............

ASKER CERTIFIED SOLUTION
Avatar of golfDoctor
golfDoctor

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the reply.........