Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21254

vb 6 adodc Operation is not allowed when the object is closed

$
0
0
I am trying to update some records.The moment the line Adodc2.Refresh executes, I get an error message saying that the "Operation is not allowed when the object is closed" Yet, when I put "On Error Resume Next", it updates the records as I want it to. Please help me thank you..

Here is my code:

Dim intResponse As Integer
intResponse = MsgBox("Are you sure you want to delete Status?", _
vbYesNo + vbQuestion, _
"Clinic System")
If intResponse = vbYes Then
Adodc2.CommandType = adCmdText
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clinic.mdb" & ";Persist Security Info=False"
Adodc2.RecordSource = "UPDATE patients Set Status = Null WHERE Status is not null"
MsgBox "Record Deleted!", vbInformation, "Clinic System"
Adodc2.Refresh
Adodc1.Refresh
End If

Viewing all articles
Browse latest Browse all 21254

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>