Unbound combo box is clear after making selection (1 Viewer)

slharman1

Member
Local time
Yesterday, 18:54
Joined
Mar 8, 2021
Messages
483
I have a form that shows all records in a query, one field is called ProductType, In the header I have an unbound combo box that gets records from the product type table and filters the detail section of the form (all records) to the selection in the combo box. All is working fine but once i select the field in the combo box it filters as it should but the combo box is blank, is there a way to keep the selection visible after being selected?
Also is there a way to add "All" or "Clear Filter" to the combo box?
Thanks
 
Can you post the code behind the unbound combobox? Maybe there's something in there that's clearing up the combo.
 
1712932855046.png

Check the combo box properties settings. The first column may be a 0" length (as in the example above). If the combo box works as intended, then it is not really blank, the bound column is just not visible. In the example above, the first column is not visible but the second and third are, so when the combo box dropdown is activated only columns 2 and 3 show, but column 1 is the bound column.

As for clearing the combo box, I use a command button that when clicked just clears the combo box:
Me.COMBO BOX NAME = Null
 
Can you post the code behind the unbound combobox? Maybe there's something in there that's clearing up the combo.
I think I've figured out why it is clearing, I am using it to filter the form so I believe it clears the combo box after the filter is applied and re-paints the screen with the filtered records - does that make sense? The combo box was made using the wizard. and gets it's value from a table, is it possible to add "all" to this combo?
Thanks
 
View attachment 113678
Check the combo box properties settings. The first column may be a 0" length (as in the example above). If the combo box works as intended, then it is not really blank, the bound column is just not visible. In the example above, the first column is not visible but the second and third are, so when the combo box dropdown is activated only columns 2 and 3 show, but column 1 is the bound column.

As for clearing the combo box, I use a command button that when clicked just clears the combo box:
Me.COMBO BOX NAME = Null
This is what i have. The primary key from the table the combo is looking up is the first column and 0 length. When I say the combo is clear after selection is made I mean it is blank but applies the filter.
 
> Also is there a way to add "All" or "Clear Filter" to the combo box?
Yes, by changing the RowSource to a union query. Example.
 
> Also is there a way to add "All" or "Clear Filter" to the combo box?
Yes, by changing the RowSource to a union query. Example.
Easy enough but...I am using the FilterByControl method in VBA to filter the records on the form and when I select the "All" selection I get the error that no items match "All" on my form.
How do I use a if then in VBA to remove the filter?
 
Hi. Please, feel free to ignore my earlier post. Good luck!
 
1712938885554.png

Try changing the bound column to 3rd column with a 0" length. Just showing the first 2 columns in the dropdown.
1712939165471.png
 
If you’ll look, you’ll see that I responded to your post. Thank you.
Right, but without seeing the code you're actually using, then we're only guessing why things are happening as you described. If you've already fixed the original problem of why it's clearing the input, then that's good. Otherwise, if you still need help with that, then posting the code might help get to an answer quicker. Saying the code was created by the wizard doesn't confirm that additional lines of code didn't accidentally get inserted in it. Hope that makes sense...
 

Users who are viewing this thread

Back
Top Bottom