Base - Prevent typing in listbox

Is there a way to prevent typing into a listbox? I am using one currently but it will save to the record anything which is typed into the listbox and I would like only the available options from the dropdown to be selected and wish to eliminate the ability to type in this field altogether.

Hello,

There may be some confusion here. With a List box, although you can type, it is not entered into the list box but only is used to recall the closest match to what is typed in.

It may be you are actually dealing with a Combo Box which is similar to a List Box but does allow entry of data not in the list.

Just change the control being used.

Edit 2020-04-02:

OK. It appears you are not familiar with table filtering. Here is a post to explain → Filter/Search with Forms (leveraging SubForms)

Have attached you sample back with a basic search form added for Statuses only, just to keep it simple. Used a List box (not Combo) and added a filter table. Select from list box and press button to get results in Table grid.

Sample ------ wip_db.odb

The list boxes on my forms, if anything is typed in and the record is saved, it saves any values typed into the list box for that record. I am trying to avoid that.

I should probably be more specific. These list boxes are running SQL and are used for a search to display results on the subform. I am guessing I am allowed to type into them because they are running SQL code, however, I am wondering if there is a way to keep from being able to type into the listbox at all.

@VoidingNixx,

Have been using List boxes for many years and do not know of a method to type in to them - SQL or otherwise. Again, with a Combo box this can be done.

Please post a scrubbed sample showing this problem.

Reading your comment again, it is confusing. If these ‘List boxes’ are used for searching to display on a sub form, why are they tied to a record to be updated.

Further explanation and sample is needed - sounds more like a design problem than what is actually being described.

To give you a general idea of the form; it contains multiple list boxes and text boxes which will take any data they hold and use for a search and display results to a subform data table.

It probably is a design flaw somewhere on my part, but not sure where it is. Each list box is associated with a particular table which holds only the entries which should be displayed for the list box. I have one main table for all records and other tables (subtables) hold pre-defined values to be used for the main table. When random text is type into the list box is entered and the record is saved, it saves to the main table. Why I can type at all in a list box is beyond me.

So the list boxes associated with the subtables will dropdown the values from those tables for input. The search is performed using what is selected in the list box. I will upload a sample very shortly.

Ok, sorry that took so long. File is being linked. Everything works fine. Just odd that it allows list boxes to be typed into and will use anything typed in as a value. Anyways, file attached: link text it does not require any macros and can run with them disabled.

Have downloaded (you could have simply attached to original question - SOP) and will examine.

However, just as mentioned multiple times already, you ARE using a Combo Box - Not a List Box.

Well what the heck? They were added as list boxes. That is all I ever use and all I ever add, because I never use combo boxes. How the heck did they change? Uggghs, you are correct, those are now combo boxes. Well, I’m dumb.

Thanks for your help Ratslinger, I appreciate your time taking a look. My mistake on this. Have a good one. :slight_smile:

@VoidingNixx,

See edited answer for sample.

Thanks much Ratslinger. To be honest, I use to use the filtering table, however, I found the method I use now to be cleaner (one less table), and since I am the only one using this database, I found it to be a bit unnecessary for my use.