Control Arrays

  • Thread starter Thread starter Tony Wainwright
  • Start date Start date
T

Tony Wainwright

Hi Guys

Is it possible to have an array of controls. If so how do you declare them
and how do you reference them.
 
Hi Tony, MS Access does not support control arrays. Every control must be
created and placed on the form in design view (look up CreateControl if this
is what you're after).

You can create a predetermined number of controls that share a similar name
and use these in a similar manner to a control array.

e.g. 10 TextBoxes named txtTextBox01, txtTextBox02, ... txtTextBox10.

To show only 5

For intCount = 1 To 5
Me.Controls("txtTextBox" & format(intCount, "00")).Visible = True
Next intCount
For intCount = 6 To 10
Me.Controls("txtTextBox" & format(intCount, "00")).Visible= False
Next intCount

HTH, Graeme.
 
Back
Top