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
 

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

Similar Threads

enumerating through certain controls 3
Looping with Multiple Controls 1
Shape Arrays VBA 0
looping thru controls 5
Control datatype? 2
Problem with subforms 3
With statement 1
Control Array to clear values 4

Top