Unanswered: Access 03: Listbox requery method not working with custom SQL
Hello, I am having some issues getting the listbox on the form to display the results of the following custom query:
Dim i As Integer
Dim typeFilter As String
Dim rqStr As String
For i = 0 To lstCompTypeCd.ListCount - 1
'Need to build this parameter based on user input
If lstCompTypeCd.Selected(i) = True Then _
typeFilter = typeFilter & "PriceTypeId='" & lstCompTypeCd.Column(0, i) & "' OR "
rqStr = "SELECT CompId, Name, PriceTypeId, CompanyId, ShopStore, " & _
" FROM [Competition Table] WHERE (LastStatusId=3 AND DeletedDt=null AND (" & _
Left$(typeFilter, Len(typeFilter) - 4) & "));"
lstCompetitors.RowSource = rqStr
Edit: BTW, [Competition Table] is a SQL-pass thru driven query
Listbox will not display the results on the form, when in form view.
Query will work correctly, and pull in the correct data, if I run the query from the design view (i.e., click on the list, choose the Rowsource combo, and press '...' to edit/view)