array

  • Thread starter Thread starter 123
  • Start date Start date
1

123

How to make control array in access XP?

Notes:

In vb6 when rename 3 or 2 control msgbox display do you want make array

In access you can’t make array be using this method

Thank you
 
Um, you can't.

You can loop through all the controls looking for the name
or Tag property, but there is no way to do control arrays.


Chris
 
can you give me simple way
to loop through all controls text box or combo box in a form
thank you
 
Hi,


You can make an array of controls too:

Dim mc( 1 to 5 ) As Control
Dim i as long

For i = 1 to 5
Set mc(i) = Me.Controls("Combo" & i )
Next i


Assuming the controls are carefully designed to be called Combo1, Combo2,
Combo3, ... Using the array of controls then avoid the concatenation, in
this case. In general, if you are not in ...control... of the design, you
may cycle through the controls collection:


Dim myCombos As New Collection
Dim c As Control
For Each c In Me.Controls
If TypeOf c Is ComboBox Then
myCombos.Add c
End If
Next c



and then, myCombos would be a collection made of just your combos.
myCombos(i) would then be able to retreive the i-th combo box ( just take
care to have the right scope for the variable myCombos).



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top