hi i searched for this problem but i wasnt to sure what to make of the answers in other topics.
i have a problem with deleting a record, i get a "runtime error 3020 update or cancel update without addnew or edit". whilst i was reading other threads i noticed a few people saying there was an error in vb with where you should place the edit and update but i tried what people said but it didnt work for me. here is my code i am not sure what is wrong with it.
EDIT: also when i F8 (debug) the error message occurs at the update partCode:Private Sub cmddeleterecord_Click() reply = MsgBox("Are you sure you want to delete this mechanic?" & vbCr & "Once this mechanic has been deleted it can not be retrieved", vbYesNo, "Delete Driver?") 'Message box asking if the user is sure they want to delete this record If reply = vbYes Then 'Message box asking if the user is sure they want to delete this record datdriver.Recordset.Edit 'Allow the user to edit the current record datdriver.Recordset.Delete 'Delete the current record datdriver.Recordset.Update 'Update the table datdriver.Recordset.MovePrevious 'Moves to the previous record MsgBox ("This mechanic has been successfully deleted") 'Message box confirming the user has deleted the record Else msg = MsgBox("Deletion has been aborted", vbOKOnly, "No deletion") 'Message box confirming the current record will not be deleted End If
i know the commenting makes it look a bit messy but thats how i kinda like to do it. any help is much appreciated![]()




Reply With Quote