pcpaasche
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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,aclis tbox
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
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,aclis
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.
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.
ASKER
Thanks for your help. Using locked and changing background color was just what I was looking for.
ASKER