我收到运行时3704关闭对象时不允许操作错误请帮我解决这个错误,我的代码是 -
Private Sub Form_Load() Ado.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & (App.Path & "\Test.mdb") & ";Persist Security Info=False;") Ado.RecordSource = "select * from Emp" Ado.Refresh Call RSRun("select EmpName from Emp") lst.Clear lst.AddItem ("All") While RS.EOF = False lst.AddItem (RS.Fields(0).Value) RS.MoveNext Wend End Sub
Im modules
Public Sub RSRun(ByVal SqlStr As String) On Error GoTo Er Set RS = Nothing RS.Open SqlStr, Conn, adOpenDynamic, adLockOptimistic Exit Sub Er: MsgBox Err.Description, vbCritical, "error-" & Err.Number End Sub
谢谢,
Yugal
答案 0 :(得分:3)
Conn
在哪里定义,是否可以在调用RS.Open...
时关闭?