In my Access database I have a global variable (Global allowEditing as Boolean) defined in a module (Main). I set this variable, then I want to use it later at the form level to disable some buttons. I’m having trouble with this.
For Each ctl In Me.Controls
ctl.Enabled = False 'Works for True or False
ctl.Enabled = allowEditing 'Throws error
Next
The error thrown is:
Run-time error ‘438’: Object doesn’t support this
property or method.
Whats happening here and how can I use the boolean value?
Each control has a
ControlTypeproperty. You can take advantage of that property to disable only those you chose from among the controls which support theEnabledproperty. This procedure will set theEnabledproperty for check boxes, combos, list boxes, and text boxes.