开发者

how to solve Runtime error 3704 in visual basic 6.0?

开发者 https://www.devze.com 2023-02-15 19:05 出处:网络
I am getting Runtime 3704 Operation is not allowed when the object is closed error Please help me to solve this error, my code is -

I am getting Runtime 3704 Operation is not allowed when the object is closed error Please help me to solve this error, my code is -

Private Sub Form_Load()
Ado.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & (App.Path & "\Test.mdb") & ";Pe开发者_如何转开发rsist 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

Thanks,

Yugal


Where is Conn defined and could it be closed at the point when RS.Open... is called?

0

精彩评论

暂无评论...
验证码 换一张
取 消