This code is to move items from 1 list to another list in vb6.
In this post list1 has diffrent datatable and list2 has diffrent datatable so the item moved from list1 will take whole record to other table.
Private Sub Command1_Click()
On Error GoTo errorhandler
Dim a As String
a = List1.Text
List1.RemoveItem (List1.ListIndex)
rs.Open "insert into tablename select * from tablename where emprname='" + a + "'", con, adOpenDynamic, adLockOptimistic
rs.Open "delete from tablename where emprname='" + a + "'", con, adOpenDynamic, adLockOptimistic
List2.AddItem (a)
Exit Sub
errorhandler:
MsgBox "Please Select an Item!"
End Sub
please comment if this post helps you...
In this post list1 has diffrent datatable and list2 has diffrent datatable so the item moved from list1 will take whole record to other table.
Private Sub Command1_Click()
On Error GoTo errorhandler
Dim a As String
a = List1.Text
List1.RemoveItem (List1.ListIndex)
rs.Open "insert into tablename select * from tablename where emprname='" + a + "'", con, adOpenDynamic, adLockOptimistic
rs.Open "delete from tablename where emprname='" + a + "'", con, adOpenDynamic, adLockOptimistic
List2.AddItem (a)
Exit Sub
errorhandler:
MsgBox "Please Select an Item!"
End Sub
please comment if this post helps you...
Comments
Post a Comment