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!

Nested loop.. problems..

Status
Not open for further replies.

Kinl

Programmer
Mar 19, 2001
168
US
Ok.. what am i doing wrong? .... something isnt working here.

arrPlayer is an array, and so is 'p' .

What I'm checking for is this... arrPlayer is fillin up with 6 variables... p1, p4, p5, etc .. or p15.. whatever, but it will have ONLY 6 variables .. Not more than 6.

If arrPlayer(0) or arrPlayer(1) or whatever array number is equal to p1 or p2 or p3, etc etc, then assign it to that variable.

Does that make sense?


For i = 0 to UBOUND(arrPlayer)

For x = 1 to 15

IF arrPlayer(i) = cstr("p" & CSTR(x)) THEN
p(x) = arrPlayer(i)
END IF
Next 'x

IF arrPlayer(i) = "other" THEN
other = Request.Form("txtOther")
END IF

Next 'i

Thanx for any help!!

d
 
I'm still pretty new at this but looking at it, I wonder if the error is here:


IF arrPlayer(i) = cstr("p" & CSTR(x)) THEN

should it read:

IF arrPlayer(i) = cstr("p" & '" & CSTR(x)"' ) THEN

I could be completely wrong but based on what I've been told/learned, when the quotes are like that it makes it a "literal"

hth
mark
:)
 
'p' dies not seem to be an array. It seems to be a set of variables that are similarly named. You can not address a variable e.g.
dim p() at run time by dynamically constructing the name if the variable.
Now if you want Request.Form("p" & Cstr(x)) that is different story because Request.Form "variables" (why do they call them that?) are actually Name/Value pairs in the Request.Form dictionary and the name can be constructed dynamically.
It would be more clear as
Dim strFormName
strFormName = "p" & Cstr(x)
Request.Form(strName)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top