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!

Creating variables in a for loop

Status
Not open for further replies.

mleduc

Programmer
Dec 5, 2001
20
CA
Hi,

I want to auto-create variables inside a for loop like the example below but it doesn't work. Please Help!!!!!!.

Here is the code I tried:

For i = 1 to 60
If eval(&quot;x&quot; & i) <> &quot;&quot; Then
eval(&quot;y&quot; & i) = &quot;String&quot;
End if
Next

I tried this also

For i = 1 to 60
If eval(&quot;x&quot; & i) <> &quot;&quot; Then
execute(&quot;y&quot; & i) = &quot;String&quot;
End if
Next

Here is the error I get
Type mismatch: 'eval'
or
Type mismatch: 'execute'

Help please

Thanks

 
You need to surround the whole field name within double quotes, like this:
If eval(&quot;x&quot; & i & &quot;&quot;)
will become (if i=1)
If eval(&quot;x1&quot;)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top