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

Array Giving a Type Mismatch

Status
Not open for further replies.

DariceLR

MIS
Jun 20, 2001
27
US
Just wanted to put this out there for those who might encounter the same mistake and perhaps get some insight from others as to why it causes a "Type Mismatch" Error:

I had code similar to the following (took a lot of code out):

while not RCMfile.AtEndOfStream
strText = RCMfile.ReadLine


Dim strReq(5), strRandReqNum
strAlpha = array("A","B","C","D","E","F")

for I = 0 to 4
randomize
mynum = Int((35 - 1 + 1) * Rnd + 1)
if mynum > 9 then
strReq(I) = strAlpha(mynum)
else
strReq(I) = mynum
end if
next
wend

Fix: Moved the declaration of the Loop and it was fine.

Question for the gurus: Why did this cause this error? Would have thought it would cause a Redeclaration error. ****************
DariceLR
:-{} :-V
****************
 
I would imagine the fact you were trying to declare the array twice (at least the second time around error out) this caused a type mismatch with it. If you take the declaration of the array out of the while loop and leave the strRandReqNum you should receive what you thought you should ahve received being a redeclaration error. _______________________________________________
[sub]{ str = "sleep is good for you. sleep gives you the energy you need to function";
ptr = /sleep/gi;Nstr = str.replace(ptr,"coffee");alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top