http://www.daniweb.com/forums/thread341763.html
Regards to that, i also wanted the system not to be able to delete Administrator Accounts
via my code also posted there.
Here's the code again:
Private Sub cmdDelete_Click()
' On Error GoTo err
Dim intYN
intYN = MsgBox("You are about to delete a record." & vbCrLf & _
"If you click Yes, you won't be able to undo this delete operation." & _
vbCrLf & vbCrLf & _
"Are you sure you want to delete this record?", vbExclamation + vbYesNo, "Confirm Delete")
If intYN = vbNo Then Exit Sub
DBLink.Execute "Delete From Users Where ID = " & lvwUser.SelectedItem.Text
DBLink.Close
Call Form_Load
txtName.Text = ""
txtPass.Text = ""
txtConfirm.Text = ""
MsgBox "The Record has been deleted.", vbInformation
Exit Sub
Err:
MsgBox Err.Description, vbCritical
End Sub
My Database field is Users and has 4 fields.
UserType, ID, UserName and Password respectively.
If the user tries to delete an account where the UserType is Administrator, it wont be deleted, else if the UserType is User, it can be.
Sorry, I'm really not good in SQL. :$