Test Value of Combo Box

  • Thread starter Thread starter S Jackson
  • Start date Start date
S

S Jackson

I have an combo box containing text values. I want to test it as follows:

If mycmboBox.Value = "EMR" Then

The debugger says this equals Null and of course, it does not work. I've
tried just about every property in the list VBA gives me and I can't figure
this one out. How do I test for the value of the text selected in the combo
box control?
S. Jackson
 
Never mind! I was using the wrong control name! Its been a long week,
hasn't it?

Okay, now I have to ask another ignorant question. I want to test for
multiple values:

If myCmboBox.Value = "EMR" or "FA" or "NA"

How do I do this? Thanks
 
Never mind! I was using the wrong control name! Its been a long week,
hasn't it?

Okay, now I have to ask another ignorant question. I want to test for
multiple values:

If myCmboBox.Value = "EMR" or "FA" or "NA"

How do I do this? Thanks

For ease of coding/reading, you might consider using a "Select Case" structure:

'***
Select Case Me.myCmboBox.Value
Case "EMR", "FA", "NA"
'Do something in this case
Case Else
'Do something else if no match
End Select
'***
 
Back
Top