在文本框中输入值时忽略是/否(复选框) [英] Ignore Yes/No (checkboxes) when value input in text box

查看:62
本文介绍了在文本框中输入值时忽略是/否(复选框)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,用户可以根据多个条件搜索模块,包括三个复选框(表示哪些进程已完成)以及用户输入模块号的文本框。


我想查询当文本框为空时返回与指示的复选框匹配的所有值,但只有当文本框中有文本时才返回指定的模块编号。


我知道我可以使用UNION查询来显示两者(复选框查询结果和文本框结果),但是为了便于使用,如果只有单个值就很方便填写文本框时显示。或者我可以简单地包括所有条件,但如果复选框也设置正确,它将只返回键入的记录。


我已经尝试使用一个查询,其中模块号的条件设置为文本框(带有... OR [txtModuleNum]是否为Null,因此如果没有输入则忽略它)并使用If语句来控制是否或者不评估复选框,但我似乎无法正确使用语法。我的代码是:

I have a form in which users may search for a module based on a number of criteria including three check boxes (indicating which processes have been completed) as well as a text box for the user to type in the module number.

I would like to make a query return all values that match the indicated check boxes when the text box is blank, but return ONLY the indicated module number when the text box has text in it.

I know I can use a UNION query to display both (check box query results and the text box result), but for ease of use it would be convenient if only the single value were displayed when the text box is filled in. Or I could simply include all the criteria, but then it would only return the typed in record if the check boxes are also set correctly.

I have tried using a query in which the criteria for the module number is set to the text box (with a ... OR [txtModuleNum] Is Null included so it is ignored if nothing is typed) and using an If statement to control whether or not the check box is evaluated, but I can''t seem to get the syntax right. My code is:

展开 | 选择 | Wrap | 行号

推荐答案

Haven没做真正的评估看看这个查询是否真的是你想要完成的东西,但是SQL中的两件事情脱颖而出:
Haven''t done a real eval to see if this query is really what you want to accomplish what you are attempting, but two things in the SQL stand out:
展开 | 选择 | Wrap | 行号



Haven没有做真正的评估,看看是否这个查询真的是你想要完成的东西,但是SQL中的两件事情脱颖而出:
Haven''t done a real eval to see if this query is really what you want to accomplish what you are attempting, but two things in the SQL stand out:
展开 | 选择 | Wrap | 行号


VBA帮助文件有关于IsNull的说法:
VBA help file has this to say about IsNull:

重要使用IsNull函数确定表达式是否包含Null值。在某些情况下,您可能期望评估为True的表达式,例如If Var = Null和If Var<>空,永远是假的。这是因为任何包含Null的表达式本身都是Null,因此是False。
Important Use the IsNull function to determine whether an expression contains a Null value. Expressions that you might expect to evaluate to True under some circumstances, such as If Var = Null and If Var <> Null, are always False. This is because any expression containing a Null is itself Null and, therefore, False.



至于你的其他IIF语句,

As for your other IIF statement,

展开 | 选择 | Wrap < span class =codeDivider> | 行号


这篇关于在文本框中输入值时忽略是/否(复选框)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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