I have some VBA code that clears checkboxes and text boxes on a continuous form, then closes the form.
The problem is whenever the code reaches the record that I edited last, it throws up the error "Error Number: 3218 Could not update; currently locked" It will happily adjust all the other records that I've edited, it's just the most recent one that I last edited that it hangs on.
Here's the code:
The table is pulling from a query, not a table.
The problem is whenever the code reaches the record that I edited last, it throws up the error "Error Number: 3218 Could not update; currently locked" It will happily adjust all the other records that I've edited, it's just the most recent one that I last edited that it hangs on.
Here's the code:
Code:
Private Sub Command182_Click()
On Error GoTo ErrorHandler
Dim db As Object
Dim rst As Object
Set db = Application.CurrentDb
Set rst = Me.RecordsetClone
rst.MoveFirst
Do Until rst.EOF
rst.Edit
rst!CertFilter = False
rst![A Defect] = ""
rst![B Defect] = ""
rst![C Defect] = ""
rst![A Defects Comments] = ""
rst![B Defects Comments] = ""
rst![C Defects Comments] = ""
rst.Update
rst.MoveNext
Loop
rst.Close
DoCmd.Close acForm, "Lifting Equipment Main"
DoCmd.OpenForm "MainInventory", acNormal
Exit Sub
ErrorHandler:
MsgBox "Error Number: " & Err.Number & " " & Err.Description
End Sub
The table is pulling from a query, not a table.