FancyPrairie
Programmer
I have a combobox that, when populated, exceeds the 64k limit. To get around the problem I programmed the onchange event so that when the user enters the first character I set the rowsource of the combobox (see code example 1 below). And, as the user continues to type, the combobox autocompletes. This worked fine for about a week and then stopped working. I haved added additional code (see code example 2) to try to resolve the problem. It works on my machine but not on my users' machines. (Note, they have Access 2007 I have 2010)
Why won't my auto complete work now? Is there a work around?
NOTE: I have other comboboxes on the same form that autocomplete ok (the 64k limit is not an issue with them).
Example 1: (This works on my machine (2010) but not on user's (2007))
Example 2: (This works on my machine but not on user's)
Why won't my auto complete work now? Is there a work around?
NOTE: I have other comboboxes on the same form that autocomplete ok (the 64k limit is not an issue with them).
Example 1: (This works on my machine (2010) but not on user's (2007))
Code:
Private Sub cboSearch_Change()
Static strChar1 As String
Dim strSQL As String
If (strChar1 <> Mid(cboSearch.Text, 1, 1)) Then
strChar1 = Mid(cboSearch.Text, 1, 1)
strSQL = "SELECT DISTINCT lngID, strFullName From MyTable WHERE strFullName Like '" & strChar1 & "*' ORDER BY strFullName;"
cboSearch.RowSource = strSQL
End If
End Sub
Example 2: (This works on my machine but not on user's)
Code:
Private Sub cboSearch_Change()
Static strChar1 As String
Dim strSQL As String
If (strChar1 <> Mid(cboSearch.Text, 1, 1)) Then
strChar1 = Mid(cboSearch.Text, 1, 1)
strSQL = "SELECT DISTINCT lngID, strFullName From MyTable WHERE strFullName Like '" & strChar1 & "*' ORDER BY strFullName;"
cboSearch.RowSource = strSQL
cboSearch.value = cboSearch.ItemData(0)
'**** note that it used to work on my machine without the following 3 lines...now they are needed
cboSearch.SelStart = 0
cboSearch.SelLength = Len(cboSearch.Text)
SendKeys strChar1, False
End If
End Sub