Filter on Keypress to recreate combo box autocomplete

N

Neil

Hello, I have a continuous form with just one text box on. I have another
text box in the form header and I want this box to serve as a user filter.
Each time the user enters a key or deletes something, I want the form to
filter down the form recordsource and display only the matching data.
My code of :

If IsNothing(txtFind) Then
DoCmd.ShowAllRecords
Else
strFind = "[MaterialName] LIKE '*" & [txtFind] & "*'"
DoCmd.ApplyFilter , strFind
End If

If IsNothing([MaterialName]) Then
MsgBox "No materials match your search.", vbInformation
txtFind = vbNullString
DoCmd.ShowAllRecords
txtFind.SetFocus
End If

doesn't seem to filter, all it does is set the focus from the txtFind box to
the first record and wipe the txtFind box. In fact the key never actually
appears on the txtFind box at all.
Is there another way to do this?
Many thanks,
Neil.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top