在您使用MS Access Combobox键入时搜索 [英] Search as you type with MS Access Combobox
问题描述
我想在 Microsoft Access 中创建一个简单的搜索类型组合框,如下图所示。
I would like to create a simple search-as-you-type combobox in Microsoft Access as shown in the image below.
注意:上面的图片来自于我想从 href =http://www.experts-exchange.com/articles/6490/Search-While-You-Type-in-a-ComboBox.html =nofollow noreferrer>此处
我的组合框命名为 ctlSearch
。使用Visual Basic,我想挂钩到 onChange
事件,检测用户输入,从而细化可能结果的列表。
My combobox is named ctlSearch
. Using Visual Basic, I would like to hook on to the onChange
event, detecting the user input and consequently refining the list of possible results. Is it possible to take this approach to implement the search-as-you-type combobox?
推荐答案
您可以设置组合或列表框类似这样:
You can set up the combo or listbox something like this:
SELECT ID,Hotel,Location FROM Sometable t
WHERE t.Hotel
LIKE "*" & Forms!YourForm!txtSearch.Text & "*"
ORDER BY t.Hotel
然后在Change事件中重新请求组合列表框。
Then in the Change event requery the combo or listbox.
这篇关于在您使用MS Access Combobox键入时搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!