Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Change color on disabled text box

Posted on 2004-09-09
7
Medium Priority
?
961 Views
Last Modified: 2010-08-05
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.
0
Comment
Question by:pcpaasche
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 400 total points
ID: 12016394
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
 
LVL 18

Assisted Solution

by:Data-Man
Data-Man earned 100 total points
ID: 12016542
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
 

Author Comment

by:pcpaasche
ID: 12016743
Thanks for your fast replies. I will test out your suggestions over the weekend.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:Parax77
ID: 12017763
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
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12017852
The colour will change if you use conditional formatting. However, the form may need to be refreshed before the change is evident.
0
 
LVL 1

Expert Comment

by:franksale
ID: 12019490
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
 

Author Comment

by:pcpaasche
ID: 12042123
Thanks for your help. Using locked and changing background color was just what I was looking for.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question