Custom CheckBox

sjr1917

Registered User.
Local time
Today, 00:40
Joined
Dec 11, 2012
Messages
47
Let me try this again...
On a form I will have a dozen or more checkboxes that determine if specific documents are required for this client. Each checkbox will have "associated" with it one or more other controls that hold data about when that document was sent, received, the score, etc.

The goal is to have the checkbox's AfterUpdate event Sub set the .enabled value of the associated controls ("Friends") on or off to match the checkbox's status.

OK, easy with the normal checkbox object's AfterUpdate event. BUT with a dozen such objects on the form that requires a dozen separate Subs.
The authors of Microsoft Access 2010 Programmer's Reference suggest creating a subclass of the standard checkbox object which allows you to add another parameter (.Friends) which is an array of the form's controls that are associated with each instance of the checkbox object.

Here's where I'm stuck
First when assigning the array of objects to the subclassed checkbox object's .Friends parameter (error msg)
Second I'm not sure I'm passing the associated object reference in the right way so as to be able to use them in my code.

A stripped down example database is attached.
 

Attachments

Last edited:
I really don't understand what you are trying to do - it seems very complicated (but then things seem complicated when one does not understand).

However, for a start, to set the values of Friends in the instance of the class object, you need to pass a variable array, not the individual values one by one.
 
I agree with Cronk about it being too complicated. I am sure by now you have solved your problem, but I would have defined all the dependant input fields possible in the Table Design with the Visible property = No, then in each controlling checkbox's OnClick event make the subsidiary fields visible e.g.
Code:
Private Sub ckDocA_Click()
    Dim ShowTheFields As Boolean
    ShowTheFields = Me.ckDocA.Value ' True or False
    Me.txtDocADtSent.Visible = ShowTheFields
    Me.txtDocADtRecvd.Visible = ShowTheFields
End Sub
 

Users who are viewing this thread

Back
Top Bottom