Conditionally Enable Simulated Checkbox Implemented as a Class

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 03:26
Joined
Jan 20, 2009
Messages
12,878
The attached demo is my version of a simulated checkbox with conditional enabling implemented using a Class.

It is precisely designed to emulate the focus behaviour of a checkbox.

It shows little bit of flicker on update but I think that is not unusual with Conditional Formatting.
 

Attachments

Galaxiom,

I got the attached error on opening??
Is there more documentation for this class?
 

Attachments

  • SimError.PNG
    SimError.PNG
    9.1 KB · Views: 420
Just found out about this via two other threads.

DB works fine for me Jack, in that it opens and the checkboxes are set and cleared.
 
I got the attached error on opening??
Is there more documentation for this class?
IIRC there is a loop that removes any existing conditional formatting. Maybe there is a problem there.
There is no validation of the controls in the parameters. Maybe you have passed a control that does not support conditional formatting.

It you turn on Break in Class Module in VBA editor it should show you exactly where it goes wrong.

Unfortunately I have not further documented it. The class itself needs more work such as the validation of the parameters.
 
I got the same error when I opened the db. Then the db opens and seems to work. If I set conditional formatting on the control, I get the error again. It happens in:

Public Property Set SimLabel(ByRef ctrl As TextBox)

And the Resume ExitPoint line is highlighted when I use cntl-break. When I add a resume so I can get back to the actual error it is -

For n = cbtxtLabel.FormatConditions.Count To 0 Step -1
cbtxtLabel.FormatConditions(n).Delete <<<===== highlighted
Next
 
Oh, I did not play around with any CF.
Merely opened the DB.
 
For n = cbtxtLabel.FormatConditions.Count To 0 Step -1
cbtxtLabel.FormatConditions(n).Delete <<<===== highlighted
Next
It needs a test to check if there is any existing ConditionalFormatting on the control. The error is thrown when there isn't any.
 

Users who are viewing this thread

Back
Top Bottom