Joe:
one possibility is to "tag" each field and then loop through the fields with
the appropriate tag value.
Dim ctl As Control
'--- turn off error handling as some objects may not have the Tag
property
On Error Resume Next
For Each ctl In Me.Controls
If ctl.Tag = "tag001" Then ctl.enabled = True
Next ctl
On Error GoTo 0
You could also do a comparison to see if it is a combo box.
For Each ctl In Controls
If TypeOf ctl Is ComboBox Then
Richard "Manxman" Killey
Developer of MS Access Databases
mailto:[email protected]
for more MS Access tips, visit
http://www.databaselessons.com
-----Original Message-----
From: [email protected]
[mailto:[email protected]]on Behalf Of Joe
Sent: January 2, 2009 4:55 PM
To: [email protected]
Subject: [Access VBA Central] Enable / Disable all Combo Boxes
Is there an easier way to enable all / disable all combo boxes and
text boxes on a form.
I have a button that is Save and Disable all combo / text boxes on a
form. And I have another button that enables them.
Currently i'm doing
Save button does
me.cbobox1.enables = true
me.cbobox2.enabled = true
etc.
then
Enable button does
me.cbobox1.enables = false
me.cbobox2.enabled = false
etc.
If you can help on this thanks!!!