Combo Box Selection of Spaces

  • Thread starter kscheu via AccessMonster.com
  • Start date
K

kscheu via AccessMonster.com

I have an unbound combo box on a form. I set the rowsource of the combo box
on open of the form. The query selects distinct states from myquery where...
order by state. Three rows are returned. The first row is blank (spaces),
next two rows are valid states. Since we have orders that have no state
entered, spaces in the state field are also valid. After update of this
combo box I check the combo box value and if it is not null, I proceed to set
my filter process. If I select the first row (spaces) when the form first
opens, the combo box value is null and my filter process does not get
executed and the form stays the same. If I then select the same row from the
combo box (spaces) again, this time the combo box value is spaces and my
filter process is executed and form requeries returning only those orders
that have spaces for the state.

This does not make sense to me. I tried to set a default value of spaces to
the combo box, but it always functions the way I explained above. In debug
mode I stopped the code on the after update event of the combo box and
simply checked the value of combo box, then returned . The first time it is
Null and the second time it is spaces???

Does anyone know why this is happening?

Thanks.
 
G

Guest

I don't know why this is happening, but you might try a workaround. Instead
of just checking for nulls, use an expression that treats nulls and spaces as
the same value, something like this:

If Trim(Nz(MyCombobox, ""))="" Then
....

Barry
 
K

kscheu via AccessMonster.com

Hi Barry,

Thanks. That worked.



Barry said:
I don't know why this is happening, but you might try a workaround. Instead
of just checking for nulls, use an expression that treats nulls and spaces as
the same value, something like this:

If Trim(Nz(MyCombobox, ""))="" Then
...

Barry
I have an unbound combo box on a form. I set the rowsource of the combo box
on open of the form. The query selects distinct states from myquery where...
[quoted text clipped - 18 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top