Thought I'd share my code for populating the AutoCompleteCustomSource in a textbox with data from an Access table or other ODBC datasource. This works, though perhaps others have found a more elegant way. In this example, I am adding a list of city names. - Jeff
Dim sStringColl As New AutoCompleteStringCollection
Dim qryCity As String
qryCity = "SELECT DISTINCT EstabCity FROM t_Estab WHERE ISNULL(EstabCity) = 0 ORDER By EstabCity"
Using connection As New Odbc.OdbcConnection("connection string goes here")
Dim cmdCity As New Odbc.OdbcCommand(qryCity, connection)
connection.Open()
Dim city_reader As Odbc.OdbcDataReader = cmdCity.ExecuteReader()
' Loop through the data.
While city_reader.Read()
sStringColl.AddRange(New String() {city_reader(0)})
End While
city_reader.Close()
End Using
EstabCityTextBox.AutoCompleteCustomSource = sStringColl