我正在尝试pre-view判断 的字段recordset是否为空/空。
If IsNull(rs.Fields("fieldname")) = True Then ...
If IsNull(rs.Fields("fieldname")).Value = True Then ...
if IsNull(rs.Fields("fieldName").Value) Then...
Run Code Online (Sandbox Code Playgroud)
所有这些方法都会引发错误......为什么?recordset在将它的值赋给变量之前,如何检查它是否为空。
小智 0
尝试使用IsDbNull()替代。DbNull 与 Null 不同。
编辑,只需循环遍历字段名称并在找到它时使用布尔值,否则使用 try catch 结构。
For Each field in rs.Fields
if field.Name = "someFieldName" then
foundField = true
exit for
else
foundField = false
end if
next
Run Code Online (Sandbox Code Playgroud)