更好的Apporach用于从查询中过滤数据 [英] Better Apporach for filtering data from query

查看:181
本文介绍了更好的Apporach用于从查询中过滤数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MS Access 2000的新手,并且一直致力于一个要求检索过滤信息的项目。我有一个 3个复选框的表单,可以根据被检查的内容过滤记录。最初,我能够确定复选框的不同组合,以根据每个组合创建查询;然而,随着更多标准被要求添加到表单上,我运行了一个排列,计算了近70种不同的组合,这意味着如果我继续使用初始技术(每个组合1个查询),将会有很多开销。有没有办法我可以进行主查询,其中表单将具有复选框,那些被检查的将与主查询一起运行,那些未检查的表格不会显示?或者是否有关于复选框使用的不同方法?

I''m new to MS Access 2000 and have been working on a project that calls for retrieving filtered information. I have a form that had 3 checkboxes that would filter records based off them being checked or not. Initially I was able to determine the different combinations of the checkboxes to create queries based off each combination; however, as more criteria was requested to be added on to the form I ran a permutation which computed to nearly 70 different combinations which means if I continue with the inital technique (1 query per combination) there will be a lot of overhead. Is there a way I can make a master query where the form will have the checkboxes and those that are checked will be ran against the master query and those that are not checked are not displayed? Or is there a different approach that should be taken regarding the use of checkboxes?

推荐答案


我是新的到MS Access 2000并一直致力于一个要求检索过滤信息的项目。我有一个 3个复选框的表单,可以根据被检查的内容过滤记录。最初,我能够确定复选框的不同组合,以根据每个组合创建查询;然而,随着更多标准被要求添加到表单上,我运行了一个排列,计算了近70种不同的组合,这意味着如果我继续使用初始技术(每个组合1个查询),将会有很多开销。有没有办法我可以进行主查询,其中表单将具有复选框,那些被检查的将与主查询一起运行,那些未检查的表格不会显示?或者是否有关于复选框使用的不同方法?
I''m new to MS Access 2000 and have been working on a project that calls for retrieving filtered information. I have a form that had 3 checkboxes that would filter records based off them being checked or not. Initially I was able to determine the different combinations of the checkboxes to create queries based off each combination; however, as more criteria was requested to be added on to the form I ran a permutation which computed to nearly 70 different combinations which means if I continue with the inital technique (1 query per combination) there will be a lot of overhead. Is there a way I can make a master query where the form will have the checkboxes and those that are checked will be ran against the master query and those that are not checked are not displayed? Or is there a different approach that should be taken regarding the use of checkboxes?



您是否可以发布当前正在运行这些复选框的示例SQL查询。


Mary

Can you post a sample SQL query that is being currently run off these checkboxes.

Mary



您是否可以发布当前正在运行这些复选框的示例SQL查询。


Mary
Can you post a sample SQL query that is being currently run off these checkboxes.

Mary



我所拥有的是5个复选框和一个命令按钮,它使用VBA代码根据条件执行搜索。这是一个例子:


如果我!chkActivity = 0和我!eval = 0和我!返回= -1而我!相对= -1和我! qualified = 0然后

DoCmd.OpenQuery" returnAndRelative",acNormal,acEdit


然后是returnAndRelative查询谁匹配字段的条件:

''返回'':不是空和[表格]![RetrieveForm]![返回]

''亲戚'' :不是空的[形式]![RetrieveForm]![relative]


你还需要更多吗?

What I have is 5 checkboxes and a command button that performs a search based off the criteria using VBA code. Here''s an example of it:

If Me!chkActivity = 0 And Me!eval = 0 And Me!return = -1 And Me!relative = -1 And Me!eligible = 0 Then
DoCmd.OpenQuery "returnAndRelative", acNormal, acEdit

Then the "returnAndRelative" query who matches the criteria for fields:
''return'': Is Not Null And [forms]![RetrieveForm]![return]
''relative'': Is Not Null And [forms]![RetrieveForm]![relative]

Do you require anything more?


我需要完整的SQL对于returnAndRelative查询。如果你不确定如何得到它。在设计视图中打开查询并将视图更改为SQL,然后将其复制并粘贴到此处。


Mary
I need the full SQL for the "returnAndRelative" query. If you''re not sure how to get it. Open the query in design view and change the view to SQL then copy and paste it here.

Mary


这篇关于更好的Apporach用于从查询中过滤数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆