H-SC
asked on
Disable all controls on a tab control except one dropdown on open
I have a form with a tab control on it. On open I would like to have everything on the tabctl disabled (if applicable) with only one combo box enabled. thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
jim,
In most cases I do just that. In this case, I would really like to have code that does the switch for all with the one exception. This particular form has a ton of fields and controls on it thus... looking for some type of shortcut approach to this particular form.
In most cases I do just that. In this case, I would really like to have code that does the switch for all with the one exception. This particular form has a ton of fields and controls on it thus... looking for some type of shortcut approach to this particular form.
ASKER
rockiroads,
thanks,
I will try...
thanks,
I will try...
In that code I only check for textboxes, listboxes and dropdowns
If u have other editable controls, ensure u add them in,
checkbox is acCheckBox
if u want command buttons disabled, then its acCommandButton
Ensure u set "mycombo" to be the control name of your combo that u want always enabled
If u have other editable controls, ensure u add them in,
checkbox is acCheckBox
if u want command buttons disabled, then its acCommandButton
Ensure u set "mycombo" to be the control name of your combo that u want always enabled
Well, if you're only wanting to disable controls on the tab then surely you'd have to consider it separately from Me.Controls
Something like
Dim ctl As Control
Dim intPages As Integer
For intPages = 0 To Me.TabControl.Pages.Count - 1
For Each ctl In Me.TabControl.Pages(intPag es).Contro ls
ctl.Enabled = False
Next
Next
Or to use Rocki's method with a small alteration
for each ctl in Me.Controls
if ctl.ControlType = acTextBox or ctl.ControlType = acComboBox or ctl.ControlType = acListBox then
if ctl.Name <> "mycombo" and ctl.Parent.Name = "TabControlName" then '<<---change here
ctl.Enabled = bEnable
endif
end if
next ctl
Something like
Dim ctl As Control
Dim intPages As Integer
For intPages = 0 To Me.TabControl.Pages.Count - 1
For Each ctl In Me.TabControl.Pages(intPag
ctl.Enabled = False
Next
Next
Or to use Rocki's method with a small alteration
for each ctl in Me.Controls
if ctl.ControlType = acTextBox or ctl.ControlType = acComboBox or ctl.ControlType = acListBox then
if ctl.Name <> "mycombo" and ctl.Parent.Name = "TabControlName" then '<<---change here
ctl.Enabled = bEnable
endif
end if
next ctl
ASKER
rockiroads,
that worked perfect !!
many thanks
that worked perfect !!
many thanks
No probs
Were all the controls you have on that form on your tab anyway? :-p
(But you perhaps imagined that the tab control makes a difference - a bit like a subform perhaps? I believe that is a common assumption).
(But you perhaps imagined that the tab control makes a difference - a bit like a subform perhaps? I believe that is a common assumption).
Leigh u up l8, I still aint recovered, still serious sore throat but at least no fever anymore but cant find a car :(
laters mate, bedtime!
laters mate, bedtime!
Late? This is where my day just gets going ;-)
Hours of work ahead of me yet :-D
Hours of work ahead of me yet :-D
That way, on open they're all disabled, and you can write code in your combo box's AfterUpdate event to make them Enabled = Yes.
Hope this helps.
-Jim