Enable/disable checkbox based on the value of a combobox (1 Viewer)

dafne

Registered User.
Local time
Today, 17:17
Joined
Apr 1, 2017
Messages
41
Hi! I want to enable/disable a checkbox based on the value of a combobox. More specifically, if the combobox values are "3", "4", "7" or "8", then the checkbox is enabled.
I placed the following code in my combobox's AfterUpdate and in the form's OnCurrent, and it works:
Code:
If COMBO = "3" Then
Me.CHECKBOX.Enabled = True
Else
Me.CHECKBOX.Enabled = False
End If
But when I modify it to
Code:
If COMBO = "3" Or "4" Or "7" Or "8" Then
the code stops working.
Please, help! This is driving me crazy and I tried everything I could think of :banghead:
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:17
Joined
Aug 30, 2003
Messages
36,118
You have to repeat the field:

If COMBO = "3" Or COMBO = "4" Or COMBO ="7" Or COMBO = "8" Then
 

dafne

Registered User.
Local time
Today, 17:17
Joined
Apr 1, 2017
Messages
41
Thank you, thank you, for your fast reply! :D
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:17
Joined
Aug 30, 2003
Messages
36,118
Happy to help and welcome to AWF!
 

Users who are viewing this thread

Top Bottom