Skip to content

Instantly share code, notes, and snippets.

@facebookegypt
Created March 10, 2013 18:13
Show Gist options
  • Save facebookegypt/5129727 to your computer and use it in GitHub Desktop.
Save facebookegypt/5129727 to your computer and use it in GitHub Desktop.
Private Sub CmdDel_Click()
'Deleting a friend.
'Make sure the update proccess is actually an UPDATE ....
'1)
If Tnm.Text = Trim$("") Then
MsgBox "Please first, pick up a friend to remove " & _
"from friends list", vbCritical, "Invalid Delete Proccess"
Exit Sub
End If
'2)
If RS.RecordCount = 0 Then Exit Sub
'3)
Dim Xs As String
Xs = MsgBox("Are you 100% sure that you wish to remove : " & vbCrLf & _
"" & Tnm.Text & vbCrLf & _
"from your friends list?", vbCritical + vbYesNoCancel, "Warning delete")
If Xs = vbNo Then
Exit Sub
ElseIf Xs = vbCancel Then
Exit Sub
Else
'OK, we can Delete now.
RS.MoveFirst
RS.Find "ID = '" & FriendID & "'"
If RS.EOF Then
MsgBox "Something went wrong", vbCritical, "Deleting Proccess"
Exit Sub
End If
RS.Delete
MsgBox "(1) entry deleted successfully", vbOKOnly, "Deleting Done"
'Prepare the ListBox Control
LstFrnds.Clear
RS.MoveFirst
Do Until RS.EOF = True
LstFrnds.AddItem Trim$(RS!Fname)
RS.MoveNext
Loop
ClearTxtBox
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment