PDA

View Full Version : [SOLVED:] Combobox with many records, update rowsource doesn't return expected values



Movian
01-19-2015, 01:22 PM
so I have two combo boxes that I am using to make selections from a table containing 76,000 + records

I have created and on change event to update the rowsource after the user types a few letters to reduce the selection down to a managable number and keep system speed up.


Private Sub FilterText_Change()
If Len(Me.FilterText.text) >= 3 Then
Me.FilterText.RowSource = "SELECT DISTINCT NONPROPRIETARYNAME FROM tblNDCList WHERE NONPROPRIETARYNAME like '" & Me.FilterText.text & "%' ORDER BY NONPROPRIETARYNAME"
End If
End Sub

However if I type in Aceta into the combo box I expect it to show everything that starts Aceta in that field however it only shows a single return Acetagesic

however if I add one more letter and make it Acetam it correctly brings up a list of 40 or so items that match that as a start of Acetaminophen

but why does it not show correctly the first time.... ?

(for those wondering yes this is a list of medications).

If I try and set the field to re query after I change the rowsource it gives me an error about saving (even though the field is unbound) and the fact that it DOES update the list shows that it shouldn't be necessary

Movian
01-19-2015, 02:32 PM
So the issue I realized after posting here is that using me.filterText.text not only came back with the text that had been typed in BUT if the system had found a close match (Auto Expand) it was including that text too...

as such turning off Auto Expand has resolved the problem and is providing the functionality that we are after, we will just have to re educate our users slightly on the work flow difference.