访问错误 2427:您输入的表达式没有值
Access error 2427: You entered an expression that has no value
我有一个表单,正在计算子表单中的记录数。有时子表单是空的,我想检查一下,但它抛出
Run-time error '2427': You entered an expression that has no value
发生此错误的原因很明显,但不太明显的是如何解决它。这是导致错误的代码。 MainTableComboBox.Value 包含 RecordID。
DCount("*", "[SubFormTable]", "[SubFormTable].[RecordID] = " & MainTableTextBox.Value)
我尝试了以下方法,但仍然出错。
- 使用
If(IsError(Dcount...)) then (do stuff)
- Checking that the number of records is larger than zero
- Nested Nothing, IfNull, and IfEmpty statements
- Using an error handler
还有哪些其他方法可以解决此错误?
我想你可以设置一个等于子表单数据源的记录集,然后使用 IF rs.EOF = True Then
查看在 运行 你的 dcount 函数之前是否有要显示的记录。有关详细信息,请参阅 this 问题。
我有一个表单,正在计算子表单中的记录数。有时子表单是空的,我想检查一下,但它抛出
Run-time error '2427': You entered an expression that has no value
发生此错误的原因很明显,但不太明显的是如何解决它。这是导致错误的代码。 MainTableComboBox.Value 包含 RecordID。
DCount("*", "[SubFormTable]", "[SubFormTable].[RecordID] = " & MainTableTextBox.Value)
我尝试了以下方法,但仍然出错。
- 使用
If(IsError(Dcount...)) then (do stuff)
- Checking that the number of records is larger than zero
- Nested Nothing, IfNull, and IfEmpty statements
- Using an error handler
还有哪些其他方法可以解决此错误?
我想你可以设置一个等于子表单数据源的记录集,然后使用 IF rs.EOF = True Then
查看在 运行 你的 dcount 函数之前是否有要显示的记录。有关详细信息,请参阅 this 问题。