Control Array

  • Thread starter Thread starter Harlan
  • Start date Start date
H

Harlan

In VB, you can create a control array, which makes looping through a counter
loop easy, thus making it easy to display the values of different variables
in text boxes.

example:
I have 30 text boxes, txt101(0) thru txt101(29)
and 30 variables Resistance(0) thru Resistance(29).

In VB I would use something like the following to load the values of the
variables into the text boxes

For I = 0 to 29
txt101(I).value = Resistance(I)
Next I

What is an easy approach to do the same in Access97

Thanks
Harlan
 
Harlan said:
In VB, you can create a control array, which makes looping through a
counter loop easy, thus making it easy to display the values of
different variables in text boxes.

example:
I have 30 text boxes, txt101(0) thru txt101(29)
and 30 variables Resistance(0) thru Resistance(29).

In VB I would use something like the following to load the values of
the variables into the text boxes

For I = 0 to 29
txt101(I).value = Resistance(I)
Next I

What is an easy approach to do the same in Access97

Thanks
Harlan

Access doesn't have control arrays, but you can use a naming convention
to number your controls and then loop to refer to each control by name.
Suppose you have controls named "txt101_0", "txt101_1", ... "txt101_29".
Then you could use code like this:

For I = 0 to 29
Me.Controls("txt101_" & I) = Resistance(I)
Next I

Control arrays aren't really much of a lack in Access, because
continuous forms do most of what you'd use a control array for.
 
Back
Top