Sort of, but not exactly like in VB6 or VB8 (note: version VB7 doesn't
support control arrays) where you create one control and then copy the
same control multiple times. Control arrays are a form of inheritance
(but that is at the design level of VB which was developed in some
version of C). You can simulate control arrays in Access by creating a
textbox and then keep copying it (or just keep creating new textboxes)
and then naming the textboxes like txt0, txt1, txt2, ...
In a VB control array you can loop through the control like
For i = 0 to 5 : Debug.Print txtN(0).Text : Next
In Access you can do this:
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then Debug.Print ctl.Name
Next
Of course, for this example, the textboxes could be named anything. But
here is a better simulation of control arrays in Access
Dim i As Integer
For i = 0 To 4
Debug.Print Me.Controls("tx t" & i).Name
Next
Or another option would be to stuff the textboxes into a Collection
object. Then you can loop through the collection object
Dim col As New Collection, v As Variant
For i = 0 To 4: col.Add Me.Controls("tx t" & i): Next
For Each v In col: Debug.Print v.Name: Next
Then only catch is that you have to know ahead of time how many
textboxes you have in Access where a VB control array knows
automatically. Of course, you could always just loop through the
controls collection of your form and anything that is a textbox gets
stuffed into the collection object (again, the textboxes could be named
anything in this case).
Rich
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!