Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate Drop-Down box if Radio Button is Checked - Outlook 2003 1

Status
Not open for further replies.

andy98

Programmer
Jul 7, 2000
120
GB
Hi

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.

Any ideas
 
What do you mean "selected" from the combobox? Do you mean:

1. the item you want is now the item showing in the visible part of the comboxbox, but it does not actually have focus?

2. the item you want is the item showing, AND the focus is actually on that item?

3. the item you want is "selected" from the list - into a variable assumably - and you are going to do something else with that value?

Gerry
 
Hi Gerry,

I'll try and explain things a bit clearer.

On my custom form - there is a Radio box and a Combi.

The radio box is called: Purchased? and the Combi contains a list of Offices where the potential purchase was made.

I need to ensure that if the Radio box is checked, then a value from the Combi box is selected as the specific Office that made the purchase.

Hope this makes it a little clearer.

Andy
 
A combobox is a list the user can choose from.

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.


Gerry
 
Hi Gerry

Thanks for your help.

I have inherited the custom form and it does seem to have redundant data entry but that's what I have to work with.

Andy
 
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.



Gerry
 
Gerry

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.

Thanks for your help.

It has cleared things up.
 
As Homer Simpson might say...and how DO you spell that? Whoowooh! GOOD reply. Bite that bullet, stand up for good design.

Better user specs...better software.

#1 question - what do you need? Make that work first. That ain't always easy....hahahahahahaha, mad laughter trailing after...


Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top