disabled textbox font color

JIMR

JIMR
Local time
Today, 12:14
Joined
Sep 26, 2008
Messages
63
Hi all,

I have some disabled textboxes in my forms to prevent the unwanted editing of data in my tables. The responses I am getting from the user and it is my opinion as well is that it should be more readable because it is useful information. I have been unable to figure out how to change the color of the font in a disabled textbox, can someone help me with this.

I suspect with many things in access there is an alternative to preventing the unwanted editing, adding etc. of data in a table that is also a better approach in the development of a database. At this time I do not know if any what that alternative might be.

Thanks in advance
 
If you simply want to prevent the data from being edited, use the Locked property instead of the Enabled property. The field will non-editable, but its appearance will not be grayed out and the data will be legible.
 
missingling

Thanks for your help I tried that yesterday and thought I had the field locked but by use of a scanner I was able to enter data and save it. I must have made a significant error (wrong field locked) because it works fine now, thank you.

If somehow I found a good reason (this is not one of them) to disable a textbox and wanted to change the default of the background and text, is it possible to make any changes. I still have not figured that out.
 
The color you see for a disabled control is a Windows System Color. You can change that system color to whatever you like using Windows API functions but the change you make will apply to any Windows application that is opened thereafter. Not a good idea.

.
 
If you use both properties, Locked and Enabled, you could also change the colors without affecting system colors. This code locks/disables a field called EmployeeID if it holds data and changes the BackColor to yellow. You could also change the font color, if desired. Unlike when you use Enabled by itself, the data is still legible when you use both Enabled and Locked as set up here:

Code:
Private Sub Form_Current()
If Not IsNull(Me.EmployeeID) Then
 Me.EmployeeID.Locked = True 
 Me.EmployeeID.Enabled = False
 Me.EmployeeID.BackColor = vbYellow
Else
 Me.EmployeeID.Locked = False
 Me.EmployeeID.Enabled = True
 Me.EmployeeID.BackColor = vbWhite
End If
End Sub
 
misingling and cyberLynx,

Thanks for the great feedback both are now available options; much appreciated.
 
Hi all, just discovered accidentally how to accomplish this. If the microsoft default color for a font or back ground is not desired. Lock the fields as well, locking the field allows you to make color changes to both the back, fore and text.
 
Any possibility to make this work in Datasheet Form?
 
Setting the Locked or Locked/Enabled Properties of a Control is the only type of Formatting, on a Datasheet View Form that can be done with code, as far as I know. The changing of the colors, for this type of Form, must be done using Conditional Formatting off of the Format Menu/Ribbon.

I'm sure that we can help you, but it would be a real help to us, in helping you, for you to give a clear explanation of your exact situation, including the Name(s) of the Control(s) involved.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom