control array

S

sps

I have several similar controls on my form that need to do
basically the same thing. I would like to be able to
create an array of the controls so I can access them all
with a loop rather than multiple procedures. How do I get
this to work in Access 2000?
 
M

Marshall Barton

sps said:
I have several similar controls on my form that need to do
basically the same thing. I would like to be able to
create an array of the controls so I can access them all
with a loop rather than multiple procedures. How do I get
this to work in Access 2000?


Access doesn't have control arrays. The usual technique is
to name the controls something like txtCd1, txtCd2, ... so
you can use this kind of code:

For k = 1 To 12
Me("txtCd" & k).Enabled = False
Next k
 
S

sps

Brackets. I was missing the brackets, thanks.
-----Original Message-----



Access doesn't have control arrays. The usual technique is
to name the controls something like txtCd1, txtCd2, ... so
you can use this kind of code:

For k = 1 To 12
Me("txtCd" & k).Enabled = False
Next k
 
Top