It was the wizard that you initially used and that failed. JamesMcS gave you the delete syntax. Using what he gave you, your code could look something like:
Amend the control name/fields highlighted. I haven't changed your logic, just inserted the DELETE statement.
Code:
dim db as DAO.Database
set db = currentdb
If (MsgBox("Deleting a supplier record will permanently delete it. Are you sure you want to delete?", vbYesNo, "Delete Confirmation")) = vbYes Then
If Me.Dirty Then
Me.Undo
' DoCmd.SetWarnings False
If Not Me.NewRecord Then
db.execute "DELETE * from [COLOR=Red][B][tablename][/B][/COLOR] WHERE [COLOR=Red][B][supplier][/B][/COLOR]=" & [COLOR=Red][B]me.supplierno[/B][/COLOR]
End If
End If
MsgBox "The supplier was successfully deleted.", , "Delete Confirmation"
End If
Last edited: