......
if data1.recordset.bof and data1.recordset.eof then
msgbox "当前数据表为空!"
exit sub
end if
......
......
做个判断就可以啦.if rs.RecordCount<1 then
msgbox ("无此记录",)
eixt sub
你参考一下.写在出错的下面就可以...要是不行就写在上面.
Dim rec As New Recordset
Dim flag As Integer
Private Sub Command6_Click()
If rec.State = adStateOpen Then rec.Close '判断记录集状态,如果是打开就先关闭
sql = "select * from txgz where ygname = '" + Text13.Text + "' "
rec.Open sql, con, adOpenStatic, adLockOptimistic '打开记录集
rec.Requery
If rec.RecordCount <1 Then
MsgBox ("无此员工!")
Exit Sub
Text13.Text = ""
Text13.SetFocus
End If
End Sub
这里是我的代码你看看.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)