简体   繁体   English

搜索列表到过滤形式 ms-access

[英]Search list to a filtered form ms-access

So I have set up a form that can search through multiple fields using the Dynamic Multi Search tool found here .所以我设置了一个表单,可以使用此处找到的动态多搜索工具搜索多个字段。 Currently it uses a list box with on OnDoubleClick event to open in another form a single record from the search list by using the following当前,它使用带有 onDoubleClick 事件的列表框,通过使用以下命令以另一种形式打开搜索列表中的单个记录

Private Sub SearchResults_DblClick(Cancel As Integer)

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frm_MainEntryForm"

    stLinkCriteria = "[ID_UniqueID]=" & Me![SearchResults]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub

Ideally I would have an option to open ALL the records found.理想情况下,我可以选择打开所有找到的记录。 I guess this would be achieved by somehow filtering the form where the ID_UniqueID column of the form matches all the values in the ID_UniqueID column of the search results box.我想这可以通过某种方式过滤表单的 ID_UniqueID 列与搜索结果框的 ID_UniqueID 列中的所有值匹配的表单来实现。

Is this even possible?这甚至可能吗? I'm not sure how to set this up or where to start?我不确定如何设置或从哪里开始? Can anyone help?任何人都可以帮忙吗?

Can build an "ALL" option into listbox RowSource with a UNION query.可以使用 UNION 查询将“ALL”选项构建到列表框 RowSource 中。

Because there are no apostrophe delimiters built into search criteria, I presume ID_uniqueID is a number field which users don't see and instead see descriptive alias:因为搜索条件中没有内置撇号分隔符,所以我认为 ID_uniqueID 是用户看不到的数字字段,而是看到描述性别名:

SELECT 0, "ALL" AS Data FROM tablename
UNION SELECT ID_UniqueID, fieldname FROM tablename;

Then code tests if 0 is selected item:然后代码测试是否选择了 0 项:

If Me.SearchResults <> 0 Then
    stLinkCriteria = "[ID_UniqueID]=" & Me![SearchResults]
End If

For another approach to building search criteria, review http://allenbrowne.com/ser-62.html .有关构建搜索条件的另一种方法,请查看http://allenbrowne.com/ser-62.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM