I have a Radio button on a Custom Form in Outlook and I want to be able to check if the Radio Button has been selected, that a drop-down value is selected from a combi.
You can make a specific item be "selected" in the list, but there is nothing to stop the user from changing it to something else. If you have logic that details a specific item, then why use a combobox?
In any case, it will be something like:
If OptionButton.Value = True Then
ComboBox1.ListIndex = 3
End If
This would display the fourth item (they are 0 based) in the combobox list. But again, the user could change this. Is that what you want?
Or is what you want, is to ensure that at least one of the combobox list is selected? In other words, you want to make sure the combobox list is not skipped over? That is another issue, and easily dealt with...if that is actually what you want to happen.
Could you explain the logic tying a True/False condition to a specific item in a list?
True Dallas
Chicago
New York
Seattle
False Dallas
Chicago
New York
Seattle
You have two choices, True or False, but FOUR results. I make a "True" choice (radio button is ON). Say you make the logic that if Value = True, Dallas is selected...well True will always make Dallas selected. The user changes Dallas to New York. Then what is the point to having True = Dallas selected?
If the combobox is a list of potential offices when a Purchased? condition is True, then it seems to me that the logic is to require a selection from that list, not to specify a selection. Especially when the user can change that specified selection.
OK, well we all have to live with inherited stuff. However, the big question still remains.
Which is - what do you want to happen??
The item is showing in the combobox is determined by the ListIndex property. ListIndex is 0 based. 0 = the first item in the list. The following decides what will show in the combobox, depending on if the OptionButton is True, or not.
If OptionButto1.Value = True Then
ComboBox1.ListIndex = whatever number you pick
Else
ComboBox1.ListIndex = whatever number you pick
End If
That is how you will do it. If you want to actually move the focus to the combobox, add Combobox1.SetFocus to the lines. Otherwise, the item showing in the combobox will change, but the combobox will not have focus. Again, though, unless you have logic behind it, there is nothing to stop the user from changing the combobox, and selecting the "wrong" Office.
That is because you are NOT "selecting" it. You are making a certain item show in the combobox - that is all. The user will still select from the combobox. If you want it to do something else, post again.
I may just bite the bullet and ask if I can get rid of the redundant radio button. It seems to me that the form has unnessesary user input that needn't be there in the first place and I could be just trying to make things more complex than they need be.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.