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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch 1

Status
Not open for further replies.

vza

Programmer
Aug 1, 2003
179
US
I am creating as HTML page with VbScript.

I have an ADO recordset created and opened with the following lines: The recordset basically returns a count of records existing for a specific field within a Table

Code:
Dim RsCount
RsCount.Open "Select Count(Field) As FLDCOUNT From Table", Cn

I just need one question anwered:
How come in a For loop used later within my procedure, do I get a Type Mismatch error at the following line??


Code:
  For i = 0 To RsCount.Fields("FLDCOUNT").Value - 1


I tried placing a number instead of the Recordset into the Loop and it worked fine. I also tried to place the value of the recordset into a variable, but to no avail (Same type mismatch error). I can't seem to figure out what I am doing wrong.....
Any responses would be greatly appreciated.

Thanks
-vza
 
what do u get if you pipe RsCount.Fields("FLDCOUNT").Value to the screen??

I guess the For i = 0 to...is expecting an integer after the 'to' have you tried

If IsNumeric(RsCount.Fields("FLDCOUNT").Value) Then
intFLDCount = CInt(RsCount.Fields("FLDCOUNT").Value)
For i = 0 To intFLDCount - 1
...etc
 
mrmovie,

When I type:
document.write(RsCount.Fields("FLDCOUNT").Value)

I get an Integer value in return...which is what I wanted.
For some unknown reson this value doesn't apply to the For Loop....

I will try your suggestions....
Thanks for your hasty responses!

Thanks
-vza
 
mrmovie,

I think I am all set.
Thanks for the help I really appreciate it.
I just think its weird how we have to convert a numeric value into an integer.....but thats another story i guess...

Here is a star for you efforts....

Thanks
-vza
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top