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.
pcpaascheAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
shanesuebsahakarnConnect With a Mentor Commented:
You can use conditional formatting if you are using A2K or later.

Set the control's Locked property to Yes and Enabled to No in order to disable the textbox. Now select it, click Format->Conditional Formatting. Change the drop down the Expression, and put this:
Form!YourControl.Enabled=False

Set the formatting how you want it to be when the control is disabled.
0
 
Data-ManConnect With a Mentor COOCommented:
I normally don't play with the enabled property.  I like to change the back style and border style to Transparent and then set the locked property to true and remove it from the tab stop.  This allows the user to copy the data if they want, but they can't change it.

Shane...you are way to fast...I bet the Access forum has one of the fastest response times.  Would be neat to have EE add that to the main page for each forum.

Mike

0
 
pcpaascheAuthor Commented:
Thanks for your fast replies. I will test out your suggestions over the weekend.
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
Parax77Commented:
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
0
 
shanesuebsahakarnCommented:
The colour will change if you use conditional formatting. However, the form may need to be refreshed before the change is evident.
0
 
franksaleCommented:
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.  

0
 
pcpaascheAuthor Commented:
Thanks for your help. Using locked and changing background color was just what I was looking for.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.