ahmedjamalaboelez
Ahmed J. Aboelez
- Local time
- Today, 10:49
- Joined
- Feb 25, 2015
- Messages
- 79
I Appreciate Your help
i have list view with records , when I'm trying to loop through selected items return error
please help to loop through listview selected items
i have list view with records , when I'm trying to loop through selected items return error
please help to loop through listview selected items
Code:
Private Sub btn_Hold_Click()
ServerConOpen
Dim cmd As New ADODB.Command
cmd.ActiveConnection = cnx
cmd.CommandType = adCmdText
Set lvwList = Me.list_search.Object
Dim i
For Each i In lvwList.SelectedItem
With lvwList
TempVars!ListText = .SelectedItem.Text
TempVars!ListIndex = .SelectedItem.Index
cmd.CommandText = "Update db_devices " & _
"SET device_status ='Hold' " & _
"WHERE device_lineid =" & TempVars!ListText & ""
cmd.Execute
.ListItems.Item(CInt(TempVars!ListIndex)).ListSubItems(6).Text = "Hold"
End With
Next i
ServerConClose
End Sub