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
Adodc1.Refresh
Adodc2.Refresh
first you refresh Adodc1 then refresh Adodc2

You are talking about Update Records, but there is no such coding Adodc1.Recordset.Update or Adodc2.Recordset.Update
Also, if you need to Delete 1 or more records, it is not written the relevant coding for deleting. Hope you have got it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.