Running a Select Case procedure off a ComboBox Value

  • Thread starter Thread starter Barkley via AccessMonster.com
  • Start date Start date
B

Barkley via AccessMonster.com

I am trying to Run a Select Case procedure off a combo box value. When one
value is chosen I want to open a query. When a different value is chosen, I
want to open another query. My Case Else is a message box that appears. What
happens is that when this procedure is executed, the message box appears,
regardless of what has been selected in the combo box... any ideas?

Thanks
 
Barkley said:
I am trying to Run a Select Case procedure off a combo box value.
When one value is chosen I want to open a query. When a different
value is chosen, I want to open another query. My Case Else is a
message box that appears. What happens is that when this procedure is
executed, the message box appears, regardless of what has been
selected in the combo box... any ideas?

Thanks

Is your ComboBox perhaps one that shows one value while displaying another? It
might not hold the values that you are testing for because they are not in the
bound column.
 
In Design view the combo box says 'Unbound'... yet in Form view clicking on
the combobox reveals a list that I have in a table...

Rick said:
I am trying to Run a Select Case procedure off a combo box value.
When one value is chosen I want to open a query. When a different
[quoted text clipped - 4 lines]

Is your ComboBox perhaps one that shows one value while displaying another? It
might not hold the values that you are testing for because they are not in the
bound column.
 
Barkley said:
In Design view the combo box says 'Unbound'... yet in Form view
clicking on the combobox reveals a list that I have in a table...

That is different. "Unbound" where you saw it means that the ComboBox is not
bound to a field in the underlying table or query that the form is bound to
(assuming the form is even bound).

What you see in the drop down list is determined by the RowSource property of
the ComboBox and if that RowSource includes multiple columns then ONE of them
has to be chosen as the "bound column". That is the column that the value of
the ComboBox will take on when a selection is made.

For example, I could have a two column RowSource that contains CustomerID and
CustomerName. I could have the CustomerID column be the bound column with a
width of zero so it does not show in the drop down list. In that case the
ComboBox will display the names of customers but it will always have the value
of the chosen CustomerID. In such a case my Select Case block would have to
test for values of CustomerID, not of CustomerName.
 
The form I created is unbound. Will that have an effect on my select case
procedure?

btw, thanks for the info on multiple columns in a combo box...
 
Back
Top