如何使查询依赖于另一个查询(附加示例)? [英] How to make a query dependent on another query (example attached)?

查看:51
本文介绍了如何使查询依赖于另一个查询(附加示例)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Access 2003中工作,并且有大约10个我希望能够查询的字段。

问题是如果我只填写3或4个字段,那么只有数据匹配只显示那三个字段(字段留空将被忽略)。

我知道Is Null将以不同的方式工作,但我只需填写字段即可显示。


我在另一个线程的某处,这个示例数据库显示它是如何完成的,通过运行几个通过让一个依赖于另一个的开始一个接一个地查询。

问题是我不知道他们是怎么做到的!如果我查看附件中的query2,并查看对象依赖项,它会显示query1。


我无法弄清楚它们是如何实现的。我所做的一切都不会导致一个查询从另一个查询运行....


谢谢!



附加文件
(27.4 KB,124 views)


嘿Nico,我希望你' '不要厌倦我感谢你,但谢谢你!


我复制了我看到的一切呃我的实际数据库,我有10个组合框(不是那个应该重要)。


我去点击第一个cbo框,然后出现以下错误:


"两个选定的表或联合查询的查询中的列数不匹配。


检查我的查询。他们认为原始是表格是同一列的两倍,而对于< All>另一个前导*。

列宽设置为0,因此第一个(绑定)列是隐藏列。这是查询使用的列。


清除?


Nic; o)


I am working in Access 2003 and have approximately 10 fields that I want to be able to query on.
The catch is that if I only fill in 3 or 4 fields, only the data that matches only those three fields will be displayed (fields left blank will be ignored).
I know the "Is Null" will work in a different way, but I need only filled in fields to display.

I fouond on another thread somewhere this example db that shows how it''s done, by running several queries one after another by making the beginning of one dependent on the other.
The problem is that I don''t know how they did it! If I look at the query2 in the attached, and look at the object dependencies, it shows query1.

I can''t figure out how they made that happen. Nothing I do will cause one query to run from another....

Thanks!!!

Attached Files
Access-EEQ-23967041SequentialQue.zip (23.2 KB, 113 views)

解决方案

The general approach I us is to take a UNION query and thus add a "<All>" option. This option is "translated" by the second combo query column into a "*", thus enabling a LIKE statement in the query.
You''ll need to force the user to make a selection, thus the OnCurrent event of the form will fill the combo''s with the "<All>" value and before activating the query it''s tested that all combo''s have a value.

The query doesn''t need any "sub queries", thus I''ve eliminated them.
Check out this working sample.

Nic;o)

Attached Files
Access-EEQ-23967041SequentialQue_NICO5038.zip (27.4 KB, 124 views)


Hey Nico, I hope you''re not getting tired of me thanking you, but thank you!

I copied everything I saw over to my actual db and I have 10 combo boxes (not that that should matter).

I go to click on the first cbo box and the folloing error comes up:

"The number of columns in the two selected tables or queries of a union query do not match".


Check my queries. They hold for the "original" table twice the same column and for the "<All>" an additional leading "*".
The column widths are set to 0 so the first (bound) column is "hidden" and that''s the column to be used by the query.

Clear ?

Nic;o)


这篇关于如何使查询依赖于另一个查询(附加示例)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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