Array Object Event

dungstar

Registered User.
Local time
Today, 23:42
Joined
Mar 13, 2002
Messages
72
I know Access VBA does not support Array Ojects, so as an alternative, I created a set of 100 checkboxes naming them with number suffix (chk1 - chk100). I have code to synchronize those 100 checkboxes to 100 rows of a listbox.

On one of the forms that I used this on, the listbox is single select. (In conjurring this question, I just came up with a solution to my question...)

My question is: Is there a way to create one event procedure for the entire group of pseudo-array objects?

For example, what I originally intended on wanting to do was, instead of having an after update event for each 100 checkbox that clears out all the other checkbox (enforcing a single select), without having to make an event procedure for all 100 checkboxes.

(The solution I will try to work with is using a frame for this particular form where it is single select, but I'm just curious if there's a way to do what I was originally trying to accomplish.)

Thanks!
 
You could set up a procedure using s.t. like:

For Each ctl in frmMyForm.Controls . . .

and then have it test for just acCheckBox type control, then setting each checkbox in the For/Next loop to False if it's not equal to the ListBox row, and True if it is.

But combining the Check Boxes into an Option Group would be much more elegant, as you've already figured out.

Regards,
John
 

Users who are viewing this thread

Back
Top Bottom