Link to home
Start Free TrialLog in
Avatar of pcpaasche
pcpaascheFlag for Norway

asked on

Change color on disabled text box

Is it possible to change the color of a disabled textbox in Access? The default gray color may be hard to read where my Access program is going to be used.
ASKER CERTIFIED SOLUTION
Avatar of shanesuebsahakarn
shanesuebsahakarn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pcpaasche

ASKER

Thanks for your fast replies. I will test out your suggestions over the weekend.
Avatar of Parax77
Parax77

if you disable the control and lock it also the color does not change,  

try something like this if you want a colour change:

dim ctrl as control
for each ctrl in me.form.controls
    select case ctrl.controltype
        case actextbox,accombobox,aclistbox
            if not ctrl.enabled then
                 ctrl.locked = true
                 ctrl.backcolor = 255
            end if
        case else
            'backcolor change not possible on these control types
    end select
next ctrl

Parax
The colour will change if you use conditional formatting. However, the form may need to be refreshed before the change is evident.
This is to elaborate on the previous comment....

The only way I know how to do this is by doing something like the code that shanesuebsahakarn gave you.  I think the Enabled botton simply grays out the textbox.  If you go in to the VBA part of the form, set the value of that text box to locked = true.  Then change the color of the text box background.  

Thanks for your help. Using locked and changing background color was just what I was looking for.