Is there a way to create a control array in a form?
I've checked in various places and can't find a reference to this, so I thought I'd post.
Is there a way to create a 'control array' of sorts on a form so that you don't have to "retype" all the code to create the input box?
Specifically, I have a listbox on my form that queries our database for values to populate the listbox, as follows:
Select a Status:
<select NAME="Status" SIZE="1">
<%objRS.MoveFirst
While not objRS.EOF%>
<option value="<%=objRS("Value")%>"><%=objRS("Value")% ></option>
<%objRS.MoveNext
wend
objRS.close
%>
</select>
This works fine to show one listbox on my form - however, I need to have a specific # (let's say 5) of listboxes that all have the same values from the recordset.
Is there a way to make something like this an array instead of having to repeat this entire thing for each listbox?
I'm quite new at this, so any help is much appreciated!! Thanks!
Thanks! That works for the items in the list, now what about....
...the actual listboxes themselves?
In other words, for each listbox that I want on the form, do I need to do a seperate control for each one, like:
<select NAME="Status" SIZE="1">
<option VALUE.....</option>
</select>
<select NAME=="Status" SIZE="1">
<option VALUE.....</option>
</select>
<select NAME=="Status" SIZE="1">
<option VALUE.....</option>
</select>
Or, can I create some kind of control array (structure, whatever), like I can do in VB, as such:
Dim ctlName As Control
Set ctlName = Form1.Controls.Add("VB.TextBox", ListArray(Index), Form1)
ctlName.Visible = True
......
(where array is assigned and indexed in prior portion of code)
Thanks for any info!
Thanks! This all makes sense.
I'll give it a whirl & see how it goes.
Much appreciated!