Lock drop down value if checkbox is NOT checked

rplohocky

Active Member
Joined
Sep 25, 2005
Messages
292
Office Version
  1. 365
Platform
  1. Windows
Hello,
I wrote this code but doesn't seem to work. I have a combobox (Combo565) that has a drop down list. I also have a check box (LetterRecieved) on a form. I am trying to lock down the combo box when value "3. Oracle Order Sent" and the check box is NOT checked. Once the user receives the letter they would check the check box and the combo box would unlock and allow the user to continue with the next steps.
Here's what I have so far. Any thoughts?

Code:
If Me.Combo565 = "3. Oracle Order Sent" And Me.LetterRecieved = False Then
Me.Combo565.Locked = True
Else
Me.Combo565.Locked = False
End If
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
to lock it - you will need to add the code to the forms oncurrent event as well as the afterupdate event of the 2 controls. Otherwise there is times it should be locked when it isn't and vice versa.

I find a good alternative is to use conditional formatting to disable the control based on an expression.

Eg: [Combo565]="3. Oracle Order Sent" And [LetterReceived]=False

On conditional formatting edit rule screen there is an option to disable the control to the right of the format options.
 
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,310
Members
451,696
Latest member
Senthil Murugan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top