Control Arrays

  • Thread starter Tony Wainwright
  • 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.
 
G

GraemeR

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top