Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS Access 2010 ListBox items not selectable

I am populating a listbox on an MS Access 2010 form with results from a stored procedure. The code I am using to populate the listbox is as follows:

Dim qdf As QueryDef
Set qdf = CurrentDb.QueryDefs("PassThroughQuery")
qdf.SQL = "EXEC Search '" & searchValue & "'"
Set rs = qdf.OpenRecordset

While Not rs.EOF
    Me.searchResultsBox.AddItem rs("name")
    rs.MoveNext
Wend

The query runs fine and the ListBox populates with the specified values, however the items in the list box are not selectable. I cannot click and highlight any of the items.

I checked the Enabled and Locked properties and they are set to True and False respectively. The "Row Source Type" is set to "Value List". I'm at a loss as to why the listbox values are behaving as the are.


1 Answers

I ran into the same problem: apparently listbox items are only selectable when editing is allowed. Maybe the forms Allow Edits property is set to false. It may also be that results from a pass through query or a stored procedure are not editable.

like image 99
Johan van der Slikke Avatar answered Mar 15 '26 23:03

Johan van der Slikke