Dlookup和DAO记录集空值返回检查 [英] Dlookup and DAO recordset null value return check
本文介绍了Dlookup和DAO记录集空值返回检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Dlookup()语句之前检查是否表包含所需的值。
同样,使用DAO RecordSet:
设置rst = db.OpenRecordset(" Select Name FROM Table1 WHERE name =''"&" AName"&"''")
MsgBox rst.Fields(" name")< ------ ---------------如果AName在此处收到错误没有从桌子上退回。
我已经尝试过如果IsNull(rst)= True然后.....但似乎第一次无法检查Null。
请帮助
解决方案
IsNull()可以应用于两者。
展开 | 选择 < span class =codeDivider> | Wrap | 行号
我有RecordSet的解决方案:
展开 | 选择 | Wrap | 行号
请参阅上面的帖子。如果没有匹配项,Dlookup将返回null。
Dlookup() gives an error if the searchkey (the field i am looking for) is not found in the table.
How to check before Dlookup() statement whether the table contains the required value.
Similarly, with DAO RecordSet :
Set rst = db.OpenRecordset("Select name FROM Table1 WHERE name=''" & "AName" & "''")
MsgBox rst.Fields("name") <--------------------- Get error here if "AName" not returned from the table.
I have tried doing If IsNull(rst) = True then ..... but seems like rst connot be checked against Null .
Help please解决方案IsNull() can be applied to both.
Expand|Select|Wrap|Line Numbers
I''ve got solution for RecordSet :
Expand|Select|Wrap|Line Numbers
See my above post. Dlookup returns null if there are no matches.
这篇关于Dlookup和DAO记录集空值返回检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆