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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Values in Combo Boxes returning a value in another one.

Status
Not open for further replies.

JesseL

IS-IT--Management
Jul 29, 2002
59
US
Hello..

I have a combo box that has 5 values. If the value "WCDH" is selected from the list, it should AUTOMATCIALLY return a value of "empty" in another combobox. "empty" is not a value in the pull down in the other combo box. Is this a problem?

Can i get a simplistic example please?

thanks
ksharp
 
here is the code: It doesn't work, Can someone tell me what i am doing wrong?

Private Sub cboUnitDescriptionID_AfterUpdate()

If Me.cboUnitDescriptionID.Value = "WCDH" Then
Me.cboSwingID = "-"
Exit Sub
End If

If Me.cboUnitDescriptionID.Value = "Casement;Door" Then
MsgBox "The Swing type must be entered"
Exit Sub
End If

End Sub


 
I'm not sure what you mean by empty. Do you mean with no value selected so it appears empty? If that is what you are trying to do then you can set cboOtherComboBox = 0. You can also move focus to the other control by doing cboOtherComboBox.SetFocus in the code.

Hope this helps! Good Luck!
 
Yes.. I should of elaborated just a little more.. Not meaning empty, as in null. I mean have the text "Empty" in combo box2 when combo box1 is a certain value that the user chooses.
 
Since you don't actually want a value in the second combo box, maybe a better solution would be to disable it for certain situations. Perhaps something like the following:

If Me.cboUnitDescriptionID.Value = "WCDH" Then
Me.cboSwingID.enabled = False
Exit Sub
End If

You could then re-enable it in the FormCurrent code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top