Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21273

how to delete if checkbox is check else delete 1 item not working

$
0
0
i added a new check box if a user wants do delete all the records in the list
if not then he choose from the list and hits the delete button
i added a code but if the checkbox is not checked it still deletes all the records from the table
what i am doing wrong?
this is my code
Code:

Dim strSQL As String
    If MsgBox("Are you sure you want To delete this record\s?", vbExclamation + vbDefaultButton2 + vbYesNo, LsVw.SelectedItem.ListSubItems(3)) = vbNo Then Exit Sub
  If Chk.Value Then
CN.Execute "DELETE * FROM TempCash"
Else
  strSQL = "DELETE FROM TempCash WHERE TempID= " & LsVw.SelectedItem.Tag
  CN.Execute strSQL
  MsgBox "deleted successfully", vbInformation
 Call Reload
  End If


Viewing all articles
Browse latest Browse all 21273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>