Discussion Locked

Set Visible property Question

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need to make a text box visible or invisible depending upon the value of a combo box on my form.
I have a combo box with 2 values Cable and wireless. When cable is selected, I need a text box named cable visible and text box named Wireless not visible, and vice versa. I have tried for a bit with the following code:
If ([Wireless or Cable] = "Cable") Then txtCableQ2.IsVisible = True
If ([Wireless or Cable] = "Cable") Then txtCableQ3.IsVisible = True
If ([Wireless or Cable] = "Cable") Then txtCableQ4.IsVisible = True
Else
If ([Wireless or Cable] = "Wireless") Then Set txtCableQ1.IsVisible = False
If ([Wireless or Cable] = "Wireless") Then Set txtCableQ2.IsVisible = False
If ([Wireless or Cable] = "Wireless") Then Set txtCableQ3.IsVisible = False
If ([Wireless or Cable] = "Wireless") Then Set txtCableQ4.IsVisible = False

End If
End Sub

Is there an easier way to do this, or what am I missing in my code?

3 replies

by chitosunday

You didnt mention the name of your combobox so i assume a name of combobox1
if combobox1.value= "Cable" then
txtcableq2.visible = true
txtcableq3.visible = true
txtcableq4.visible = true
else
txtcableq2.visible = false
txtcableq3.visible = false
txtcableq4.visible = false
end if

This discussion is closed to new replies.