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

Variable Variables or Multidimensional Arrays

Status
Not open for further replies.

nzgirl

Programmer
Feb 26, 2003
72
NZ
Hi there.
I want to :
1) read through a database table and return all rows
2) for each row display (on the screen) a checkbox and input textbox
ie.
cb NAME inputbox
cb NAME inputbox
cb NAME inputbox
cb NAME inputbox

3) be able to see what checkboxes are ticked and values of the textbox on that row.
4) write to files.

1 and 4 are simple.
2 -is usually done thru a recordset

3 is the issue
I'd usually do it (in another language) with a multidimenisional array -except that I don't know how many rows the table will contain.
And I can't find a way to add to a multi diminesional array 'on the fly'.
OR to set the size of the array based on number of rows returned.

my other option for 3 would be a variable variable
ie while not recordset.eof
<td><input type=&quot;checkbox&quot; name=&quot;ID<% = recordset.Fields(&quot;ID&quot;) %>&quot;></td>
<td><span class=&quot;menutext&quot;><% = recordset.Fields(&quot;Description&quot;) %></span></td>
<td><span class=&quot;inputtext&quot; name=&quot;Date<% = recordset.Fields(&quot;ID&quot;) %>&quot;><% = recordset.Fields(&quot;Date&quot;) %></span></td>
wend

is this possible or am I wasting my time???

Thanks :)
 
Here's how to define and use dinamic arrays in VBscript :
- First define your array with no dimensions like this :
Code:
    dim myArray()
- Then resize it this way :
Code:
    For i = 1 to 10
      For j = 1 to 50
        redim Preserve myArray(i,j)
        myArray(i,j) = &quot;This is cell (&quot; & i & &quot;,&quot; & j & &quot;) of myArray&quot;
      Next
    Next
Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top