是不是mrc只定义了,没实例化? 如果你是使用ADO,那么定义的时候同时给它实例化: Dim mrc As New ADODB.Recordset
Dim Con As ADODB.Connection Dim rs As ADODB.Recordset Set Con = New ADODB.Connection strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\计划管理系统.mdb;Persist Security Info=False" Con.Open strCon Set rs = New ADODB.Recordset strsql="select * from table" rs.Open strsql, Con, adOpenKeyset, adLockOptimistic if not rs.eof then message "有数据" else message "无数据" end if
在线等待!
如果你是使用ADO,那么定义的时候同时给它实例化:
Dim mrc As New ADODB.Recordset
Dim rs As ADODB.Recordset
Set Con = New ADODB.Connection
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\计划管理系统.mdb;Persist Security Info=False"
Con.Open strCon
Set rs = New ADODB.Recordset
strsql="select * from table"
rs.Open strsql, Con, adOpenKeyset, adLockOptimistic
if not rs.eof then
message "有数据"
else
message "无数据"
end if
Dim mrc As New ADODB.Recordset
Dim mrc As New ADODB.Recordset