Question

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

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top