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!

Autoincreasing the variablename with 1 in a loop

Status
Not open for further replies.

RoKKos

Programmer
Feb 3, 2003
50
SE
ok... have been working to long today
Code:
    Dim i
	i = 0	
	Do While i <> 7
		response.Write &quot;The question:<strong>&quot; & quest(&quot;1&quot;) & &quot;</strong><br>&quot; &_
		&quot;<strong>You answerd:</strong>&quot; & an1(qnr1) & &quot;<br>&quot; &_
		&quot;<strong>Our answer to that is:</strong>&quot; & re1(qnr1) & &quot;<hr>&quot;
		i = i + 1
	Loop

The thing is that I want the variable an1 and re1 to increase with 1 each time the loop loops ie. replase the number with i... can this be done??? something like
Code:
an & i & (qnr1)
 
What kind of variable are &quot;an1&quot; and &quot;re1&quot;? Are they recordsets? functions?

Earnie Eng
 
Why not just user an1(i) and re1(i)?

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
Tarwn>>
Becouse I have 7 anX() arrays and 7 reX() arrays and qnr1 I get with a request.form()
 
You could use multi-dimensional arrays such as an(x,7) or re(x,7). Would that concept work in the rest of your code?

If you must, I guess you could use the eval() method which is part of the Global object. Reading an evaluated value isn't hard, but I don't know about writing.
 
You could use Eval function to get the values from variables
Actually that's what the function does, evaluates an expresion, does not executes any other code.
Eval gets the string representation of the expresion and returns it's value.
Code:
 msg=Eval(&quot;an&quot; & i & &quot;(qnr&quot; & i &&quot;)&quot;)

________
George, M
 
will try the multidim. array.. think that in could work thanx :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top