Hello, I am having an issue with Style 0 Comboboxes where when a user enters something in the box that is not a contained item, it will not store to tables or so on when it is time to use the value of the object. Any help is greatly appreciated!
Thanks!
I assume you expect what you type in the Combobox should be stored into the rowsource. That's not happening.
Every control saves to it's controlsource (the grid is an exception, but within it, the columns all maintain their controlsource, too).
As you see the Combobox has two data sources. The data source to define its items is the rowsource. The controlsource both determines what item is picked and where the picked item or entered text is saved.
The entered text becomes the value of the combobox, just like the picked item text. Unless you bind the controlsource to an integer foreign key field, that won't work with a dropdown combo style combobox.
Anyway, the combobox never maintains the items. You can have a textbox with autocomplete feature, if you want that. Or program the adding of items yourself.
What you are seeing is normal. It is how Stype 0 combo boxes are designed to work.
It might help to keep the following in mind:
If the user picks an existing value from the list, the Value property will contain that value. If the combo has more than one column, the Boundcolumn property indicates the column from which the Value is taken. The DisplayValue property always contains the value from the first column.
If the user types in a new value, the Value property will be empty; DisplayValue will contain the value that the user types.
In the second case, you need to write code to update the underlying table (or take whatever other action is appropriate). If that action results in adding the new value to the list, you should call the combo box's Requery method in order for the list to be updated.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.