Hi. May anyone please help me get rid of this error: " Operation is not allowed when the object is closed ".
I'm using vd6 Adodc1 to connect to database. I'm trying to change password, and it actually updates it but it comes with above error after an update is done. How do I eradicate this problem.
Below is my code:
Private Sub cmdUpdate_Click()
On Error GoTo errHandler
Dim mSQL As String
Screen.MousePointer = 11
With Adodc1
.CommandType = adCmdText
mSQL = " update princ_access SET [password] = '" & txtNewpass.Text & "' WHERE password like '" & txtOldpass.Text & "'"
.RecordSource = mSQL
Adodc1.Refresh
End With
Set txtNewpass.DataSource = Adodc1
errHandler:
Screen.MousePointer = 0
MsgBox Err.Number & Err.Description
End Sub
From the horrible syntax, I assume that you meant to type VB6 rather than vd6.
Reading your code (and I'm not a BASIC programmer), it looks awfully like your error handler is going to get called even when there's no error (i.e immediately after the line: "Set txtNewpass.DataSource = Adodc1 ".)