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!

sample VB code for combo boxes

Status
Not open for further replies.

Trekk

Programmer
Aug 16, 2001
66
US
I have 2 fields both are combo boxes. I need some example code that if one combo box is null no data in it then it will set the other combo box to a default value.

One combo box is populated with usernames and the other is populated with status codes like active unassigned, etc.

If there is not a name in the user combo box then I want the status to read unassigned.
 
Perhaps:

Code:
If Nz(cboUserName,"") = "" Then
  cboStatus = "Unassigned"
Else
  cboStatus = "Assigned"
End If


 
I tried that but I cant seem to get it to work

Here is my code

Private Sub Form_Load()
If Me.CareCoordinators.Value = "" Then
Status.Value = "Unassigned"
Else
Status.Value = "Assigned"
End If
End Sub

I tried pasting your code and just changing the names of the objects they were referencing but it was throwing up an error about type mismatch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top