Question : Color of Disabled Fields

When fields in Access are set to disabled, background color goes dark gray and text changes to light gray.

Is there any way to control background and foreground color for disabled fields?

Answer : Color of Disabled Fields

afaik = as far as I know

I hate the same thing you do.  Because of that, I rarely disable controls, but I do set their locked property to True to prevent users from editing them.  The way I do this is via a subroutine I created (shown below).

The first thing I do is set the conditional formatting of all textboxes, lists, and combo boxes so that when the control has the focus, it changes color (I usually use a pale blue).  This make it easier for the user to know which control has the focus.

Then, if I want to "disable" one of these controls, I instead call this subroutine which locks the control, and, if the control is a textbox, combobox, or listbox, changes the conditional formatting so that instead of whatever the original color is, it now displays as Black on Red if the control is locked.  Although I don't to it in this subroutine, you could easily expand this so that for other control types, it would change the background style and color of the label associated with these controls.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
Public Sub LockControl(ctrl As Control, Optional Locked As Boolean = True)

    On Error GoTo LockControlError
    
    Select Case ctrl.ControlType
        Case acTextBox, acComboBox, acListBox
            ctrl.Locked = Locked
            If ctrl.FormatConditions.Count > 0 Then
                ctrl.FormatConditions(0).BackColor = IIf(Locked, RGB(255, 0, 0), RGB(209, 234, 240))
            End If
        Case acCheckBox, acOptionGroup
            ctrl.Locked = Locked
        Case Else
            'do nothing
    End Select
        
LockControlExit:
    Exit Sub
LockControlError:
    msgbox "Error encountered locking form!"
    
End Sub
Random Solutions  
 
programming4us programming4us