Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error on ASP page 1

Status
Not open for further replies.

ChuckG

MIS
Feb 28, 2001
211
US
I'm fairly new at ASP/VBScript writing, but I'm getting an odd error that I don't understand why I'm getting it.

The error is

Microsoft VBScript runtime error '800a000d'

Type mismatch

/sierrajit/charts/rai/add_calc.asp, line 47

Line 47 of the page is

rai_1 = a_act_1 / a_tot_1

Before this line run's the values of these three variables are.

rai_1 is a empty variable, created with a Dim rai_1 at the beginning of the page.

a_act_1 and a_tot_1 where both declared at the begining of the page, but have had numeric values inserted into them from a database.

I'm using the following code to place the data into these variables.

a_tot_1 = objRS("A_ITEM_TOTAL")
a_act_1 = objRS("A_ACTIVE")

If I put a response.write just before line 47, forcing it to display the values of both of those variables, they show the correct numeric values.

Any idea's why I would be getting a "type mismatch" ?

Thanks
Chuck
 
Here's another wierd item.

I just did a VarType on all three variable's to check what subtype they are.

(I also added a line rai_1=0 just so it had a numeric value)

rai_1 came back type 2 (integer)

a_tot_1 and a_act_1 both came back with type 14, which I can't even find a type 14 on my list of subtype's.
 
if they should be integers, then do this on your assignment statement:

a_tot_1 = cint(objRS("A_ITEM_TOTAL"))
a_act_1 = cint(objRS("A_ACTIVE"))

which will cast them both to an integer subtype -- see if that works it out.

:)
Paul Prewett
penny.gif
penny.gif
 
Thanks Paul,

Yes that corrects it, I had JUST finished making those same changes when I got the email saying you'd posted a reply lol.

I wound up using Clng instead of int due to the rai_1 field needed to be a percentage (with decimal). But it seems to be working fine now.

The data subtype of 14 was throwing me off.

Chuck. :>
 
If you need a decimal, you should use cdbl

clng is nothing but a bigger integer. Should make no difference on the outcome of rai_1, though, since it is the one that needs a decimal, not the others.
penny.gif
penny.gif
 
Hey chuckG,
Just so you know, if someone helps you out with info, you can mark them for tip-master by clicking on "Let [userName] know this post was helpful" at the bottom of each of the other persons replies.

Just kinda a way to pay them back for taking their time to help you out. Just thought I'd let you know in case you didn't notice that. :cool:

-Ovatvvon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top