Private Sub delBtn_Click()
rs.Open
Dim list As ListItem
Set list = ListView1.ListItems.Add(, CStr(rs!Project_Name))
confirm = MsgBox("Do you want to delete the Employee Record", vbYesNo + vbCritical, "Deletion Confirmation")
If confirm = vbYes Then
ListView1.ListItems.Remove ListView1.SelectedItem.Key 'this line gives error
Dim CM As ADODB.Command
Set CM = New ADODB.Command
Set CM.ActiveConnection = con
CM.CommandType = adCmdText
CM.CommandText = "DELETE FROM bmsTable WHERE Project_Name= ?"
CM.Parameters.Append CM.CreateParameter("@Name", adVarChar, adParamInput, 50, ListView1.SelectedItem.Key)
CM.Execute , , adExecuteNoRecords
MsgBox "Record successfully deleted..", vbInformation, "Success"
End If
End Sub
Kent_4 0 Newbie Poster
rproffitt 2,662 "Nothing to see here." Moderator
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.