过滤列表框 [英] filtering a listbox
问题描述
我搜索过但没有找到我的问题的答案,所以我发帖。
我有一个名为FieldData的表,其中包含一个查找字段,可以从另一个表中获取数据TrainerInfo在一个字段中的名字(John Q. Public,Sr。)并且效果很好。
我想知道的是当开始输入名称John时,可以下拉列表仅在字段中使用John过滤名称。此外,有没有一种方法(类似于搜索Windows资源管理器),因为我输入的字段被缩减为只有我输入的匹配,无论字母串在哪里。作为一个例子,输入Pub会将列表缩小到John Q. Public,Al''s Pub,Public Morals等。
该列表有超过一千条记录,所以这会产生数据输入时输入更有效率约翰史密斯并滚动浏览名称以获得约翰琼斯,以及如果我只有初步说法J.布朗我可以输入布朗并找到约翰布朗。
我知道这会发生在网页和窗口中,所以我想知道如何实现。
谢谢
I have searched and not found an answer to my question so I am posting.
I have a table named FieldData with a lookup field that gets data from another table TrainerInfo that full names in a single field (John Q. Public, Sr.) and it works great.
What I would like to know is when start to type the name "John", can the dropdown list filter names only with John in the field. Also, is there a way (similiar to searching windows explorer) where as I type the field is reduced to only matches of what I have typed no matter where the letter string. As an example typing Pub would narrow the list to John Q. Public, Al''s Pub, Public Morals, etc.
The list has over a thousand records so this would make data entry more efficient when typing say John Smith and scrolling through hundres of names to get to John Jones, as well as if I only have an initial say J. Brown I can type Brown and find John Brown.
I know this happens in web pages and windows so I would like to know how to implement if possible.
Thanks
推荐答案
你可能想看看这段代码。我上次运行它时工作得很好: http://bytes.com/topic/access/answer...em#post3787104 您还需要将AutoExpand属性设置为否。这是在帖子稍微进一步说明的。
You might want to look at this code. It was working pretty well last time I ran it: http://bytes.com/topic/access/answer...em#post3787104 You''ll also want to set the AutoExpand Property to No. That is addressed a little further down the post.
我试图实现这个,它似乎没有工作。我将附加组合框使用的查询中的代码。它已经内置了一个过滤器,因为训练器数据是特定于轨道的,因此它们的名称可能会在表格中出现多次。
I have tried to implement this and it does not appear to be working. I will attach the code from the query that the combo box uses. it has a filter built in already as trainers data is track specific therefore their name may appear multiple times in the table.
你必须将TrainerData.Track的Where子句与用户键入的内容合并......这样的东西:
You''ll have to merge the Where Clause of the TrainerData.Track with what is typed in by the User... Something like this:
这篇关于过滤列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!