Adodc1.RecordSource = "select * from A where 型号='" & Trim(txt型号.Text) & "'"
Set rs = Adodc1.Recordset
'判断是否有重复记录
If rs.EOF = False Then
MsgBox "型号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
txt型号.SetFocus
.......
Set rs = Adodc1.Recordset
'判断是否有重复记录
If rs.EOF = False Then
MsgBox "型号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
txt型号.SetFocus
.......
adodc1.refresh
...
Adodc1.refresh
Set rs = Adodc1.Recordset
dim rs as new adodb.recordset
dim sql as string
sql = "select * from A where 型号='" & Trim(txt型号.Text) & "'"
cn.open CONNECTIONSTRING '连接字符串
rs.open sql,cn
if rs.eof and rs.bof then
msgbox "没有记录"
else
set Adodc1.RecordSource=rs
Adodc1.refrish
end if
cn.close