Control Array In VBA

racerrunner

Registered User.
Local time
Today, 06:24
Joined
May 29, 2005
Messages
32
Hi all,


I have a form that has 5 command buttons. There are Edit, Add, Delete,Save,Print.

May I know how to create a control array for these command buttons. Thank you.
 
racerrunner,

VBA doesn't support arrays of controls.

In some instances, (like for textboxes), you can name then with an integer
appended to the end; txtValue1, txtValue2, txtValue3 ...

Then you can loop through them referring to them as: Me.Controls("txtValue" & CStr(i))

You can also use an Option group. It will easily convey which SINGLE member is
selected.

Wayne
 
I have been trying to find out how to do this for a week now. I know you sent this 8 yrs ago but Thank you. You are awesome
 
You can absolutely have an array of controls . . .
Code:
dim vArray
vArray = Array(Me.Text1, Me.Text2, Me.Text3)

dim var
for each var in vArray
   debug.print var.name, var.value
next
 

Users who are viewing this thread

Back
Top Bottom