VB ACCESS数据库判断

来源:百度知道 编辑:UC知道 时间:2024/07/03 09:05:25
我VB是控件adodc连接数据库的。
数据库是 001.mdb 001内有2个表 002 和003
002有9个字段 003有11个字段

现在判断002中adodc1.Recordset(2)和adodc1.Recordset(3) 中数据是否和003下所有字段下的数据有重复 如果有msgbox"111"代码怎么写?

if adodc1.Recordset(2)=adodc1.Recordset(3) then msgbox"111"

sql="select * from 003 where 这里是003的字段='"&adodc1.recordset(2)&"'"or'"&adodc1.recordset(3)&"'
rs.open sql,conn,1,1
if not rs.eof and not rs.bof then
msgbox"111" '重复
else
msgbox"000"
end if
rs.close
set rs=nothing