多个选择,包括查询中的Null [英] Multiple selects including Null's in a query

查看:74
本文介绍了多个选择,包括查询中的Null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想从表单中选择多个变量并将它们传递给查询,但我不介意使用了多少变量。


我目前正在使用语法;


喜欢[Forms]![Form Name]![Combo Box Name]& *


在查询中的每个字段上,我希望能够过滤我的报告。然而,它忽略了我的空字段,并且鉴于我有10个以上的变量,并且它们都不是必需字段,我得到的结果很少。有没有办法做到这一点,但也包括空值?


我使用的是XP和Access 2003.




下面很长的啰嗦代码......

Hi,
I want to select multiple variables from a form and pass them to a query, however I don''t mind how many of the variables are used.

I am currently using the syntax;

Like [Forms]![Form Name]![Combo Box Name] & "*"

On each of the fields in the query I want to be able to filter on for my report. However it is ignoring my null fields and given I have 10+ variables and none of them are required fields I am getting very few results. Is there any way to do this but to include nulls as well?

I am using XP and Access 2003.



Very long winded code below...


展开 | 选择 | Wrap | 行号

推荐答案

在WHERE子句中尝试使用OR而不是AND。
Try using OR instead of AND in your WHERE clause.


这确实有效,但它现在返回非预期行的值。


例如,如果我们想要由Damon Reid和Mechanical物品提升,它现在返回Damon Reid和所有Mechanical物品而不是Damon Reid提出的机械物品所提出的所有物品。


我需要将它保持为AND但我需要能够在*中包含空值。搜索。


感谢您的尝试。
That does work but it now returns values for rows not intended.

For example if we wanted raised by Damon Reid and Mechanical items it now returns all items raised by Damon Reid and all Mechanical items instead of the Mechanical items raised by Damon Reid.

I need to keep it as AND but I need to be able to include nulls in the "*" search.

Thanks for the try though.


我觉得这太简单了!

让我来看看它,我会回复你。
I thought it was too easy!
Let me think about it, and I''ll get back to you.


这篇关于多个选择,包括查询中的Null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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