Message 1 of 11
Iterating controls?

Not applicable
01-18-2002
12:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys,
I have a form with about 20 checkboxes on it and I need to perform a
similar action for each box that is checked. Rather than monotonously
using :
if check1.value = true then,,,,,if check2.value=true then
ect., ect,
I'm trying to access them in a loop such as:
dim cbox as checkbox
for each cbox in form1 or for each cbox in form1.controls
or
for I = 0 to form1.controls.count, ect.
The problem is that I cannot access the controls collection in the form
to get a count and a variable defined as a checkbox stays set to nothing
when it hits the loop. I did not create a controls array when I added
these to the form, they're all individuals. Did I mess up? How can I
loop through the checkboxes on a form?
-Josh
I have a form with about 20 checkboxes on it and I need to perform a
similar action for each box that is checked. Rather than monotonously
using :
if check1.value = true then,,,,,if check2.value=true then
ect., ect,
I'm trying to access them in a loop such as:
dim cbox as checkbox
for each cbox in form1 or for each cbox in form1.controls
or
for I = 0 to form1.controls.count, ect.
The problem is that I cannot access the controls collection in the form
to get a count and a variable defined as a checkbox stays set to nothing
when it hits the loop. I did not create a controls array when I added
these to the form, they're all individuals. Did I mess up? How can I
loop through the checkboxes on a form?
-Josh