Reverse function of yes/no check boxes

dwcrockford

New Member
Joined
Sep 1, 2015
Messages
27
I have seen many posts (here and elsewhere), where you can use an iif statement based on whether a checkbox is marked true/false (yes/no, 0/1).

Is there a way to have the checkbox toggle on/off based on the value of another object.

In this instance the two objects involved are:

checkbox (yes/no)
Location - based on a drop down (different table) listing countries.

What I want is if the country "Canada" is selected out of the drop down options, I want the checkbox to switch to "true" (on).

Both objects are located in the same table. "Locations" are a linked lookup table.

I've tried every variance of an iif statement but none work.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I try not to use IIF statements too much, especially when there's an event that fits the bill perfectly. Use the AfterUpdate event of the combo (with your control names of course):
If Me.Combo = "Canada" Then
Me.Check = True
Else
Me.Check = False
End If
 
Upvote 0
Code:
Private Sub Location_AfterUpdate()

If Me.Location = "Canada" Then Me.Checkbox = True

End Sub

Seems to work okay.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,829
Messages
6,162,229
Members
451,756
Latest member
tommyw

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