我不知道为什么我的代码没有返回正确的记录数。我有:
counter = DCount("*", "tbl1", "[Check] = FALSE OR DateDiff('d', [CheckDate],
Date()) > 365 And [Room] = '" & Forms!frmSelect.txbSelect.Value & "'")
checkIndicator.Caption = "(" & counter & ")" & " available!"使用[Check] = FALSE OR DateDiff('d', [CheckDate], Date()) > 365的部分似乎工作正常,但整个代码却不工作。提前感谢!
发布于 2019-08-09 21:44:25
当前代码将返回tbl1中的记录计数,其中:
[Check] = FALSE (用于任何值的[Room])或
DateDiff('d', [CheckDate], Date()) > 365 和 [Room] = Forms!frmSelect.txbSelect.Value根据所需的结果,我猜您需要[Room] = Forms!frmSelect.txbSelect.Value to 总是是true,因此逻辑应该以以下方式用括号括起来:
"([Check] = FALSE OR DateDiff('d', [CheckDate], Date()) > 365) And [Room] = '" & Forms!frmSelect.txbSelect.Value & "'"
^ ^
| |
+----------------- Added parentheses here ------------------+这将返回tbl1中的记录计数,其中:
[Room] = Forms!frmSelect.txbSelect.Value和
[Check] = FALSE 或 DateDiff('d', [CheckDate], Date()) > 365https://stackoverflow.com/questions/57432691
复制相似问题