Accessing controls with calulated names (1 Viewer)

Geirr

Registered User.
Local time
Today, 03:43
Joined
Apr 13, 2012
Messages
36
Hi.

I have a form with multiple controls, mostly check boxes and text fields.
The check boxes are named like chkbox1 to chkbox15

What I would like to do, is the posibility to access the checkboxes like this:

Counter = 1
Do While Counter < 15
Me.chkbox + str(Counter) = False
Counter = Counter + 1
Loop

I know this code will not work, I will only show what I want.
Can anybody help me solving this, or maybe give me a hint where to look?

Regards,
Geirr.
 

Isskint

Slowly Developing
Local time
Today, 02:43
Joined
Apr 25, 2012
Messages
1,302
it is pretty close.

Code:
Counter = 1
Do While Counter < 15
    Me("chkbox" & ltrim(str(Counter))) = False
    Counter = Counter + 1
Loop
 

Geirr

Registered User.
Local time
Today, 03:43
Joined
Apr 13, 2012
Messages
36
Hi Isskint.

It may not supprise you, this works exactly the way I wanted! Thanks!

Regards.
Geirr
 

Users who are viewing this thread

Top Bottom