How to gray out text box and combo when a condition is met? RRS feed

  • Question

  • Hello all,

    I'm new to Microsoft Access 2016.  I'm working on a form.  I have a combo box control.  When a specific value is selected this box control (box control is 4), example, when "St. Louis" is selected from the box control, I need to gray out the following controls:



    Text 7

    Combo Box 8


    Please help.  Thank you for all your help.

    Warm Regards,


    Wednesday, July 25, 2018 7:35 PM

All replies

  • Hi,

    Probably, the simplest way is to use Conditional Formatting. You can use an Expression Is condition to check the value selected from the combo and then "disable" the control to gray it out. The only drawback is you'll have to apply the Conditional Formatting to all the controls you want to disable.

    Hope it helps...

    Wednesday, July 25, 2018 7:41 PM
  • Text912


    Hi siumui00,

    Apart from your question some remarks.

    On this moment you know what the control Text912 represents. But do you know that still after a year? Or do the next developper know that?

    Better change the control names to understandable names (without spaces or special characters).

    Next, in the lifetime of the form you have already created almost 1000 controls. On day or the other you will reach the limit that you can not add new controls any more. You can think of re-creating a "fresh" form.


    Wednesday, July 25, 2018 8:47 PM
  • Hi,

    Thank you so much for your help.  I poked around and I am able to disabled the controls:).  Have a great day!

    Wednesday, July 25, 2018 9:24 PM
  • Hi,

    Great suggestion there!  I had to put comments in the script to identify what is Text912 and all of the rest.  I will change it for clarity.  I inherit the form from other developer.  :) 

    Thank you for your help.  Have a great day!

    Wednesday, July 25, 2018 9:26 PM
  • Hi,

    Thank you so much for your help.  I poked around and I am able to disabled the controls:).  Have a great day!


    Congratulations! Glad to hear you got it sorted out. Good luck with your project.

    Wednesday, July 25, 2018 9:31 PM
  • Hello siumui00,

    Glad to hear that your issue has been solved. I would suggest you mark the helpful reply to close the thread. 

    If you have any other issue, please feel frees to post threads to let us know.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 26, 2018 2:46 AM