[英]MS-ACCESS: Filter a table, then display in unbound listbox
In my form Main
I am trying to have a push button Search
display a few columns from Table
into an unbound listbox (located on form Main
) after applying a filter. 在我的形式
Main
我想有一个按钮Search
显示从数列的Table
到一个未绑定列表框(位于形式Main
应用过滤器后)。 Initially I was using a ComboBox, but I would like to use a listbox that only displays the names of those who are overdue on training. 最初,我使用的是ComboBox,但我想使用一个列表框,该列表框仅显示那些在培训中过期的人员的姓名。 Below is what I had when using a ComboBox, which worked perfectly.
以下是我使用ComboBox时的效果,效果很好。
Private Sub SearchCheck_Click()
Call Search
End Sub
Sub Search()
Dim Task As String
Me.Refresh
Task = "SELECT * FROM Table WHERE DateDiff('m', [Training], Date()) > 24 And [Active Employee] = True"
DoCmd.ApplyFilter Task
End Sub
Surely, I imagine I am missing something that tells it where to place the results? 当然,我想我缺少可以告诉结果放置位置的内容吗? Any ideas?
有任何想法吗? I am rather new to MS-ACCESS.
我对MS-ACCESS相当陌生。
除非您希望在运行时将列表框RowSource从非过滤列表更改为过滤列表,否则只需在设计中设置RowSource属性即可,而不要使用VBA。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.