Someone help me fix this!!
Sorry, this is an old post I figured out almost immediately, I tried to edit this before anyone saw it, so disregard the reply I got.
Here is a sub I wrote for a listview's doubleclick event:
VB Code:
Private Sub lvwVolumeList_DblClick()
Dim a As String
Dim b As Long
Dim c As String
Dim lvw As ListView
Set lvw = lvwFileList
Set rs = New ADODB.Recordset
If lvw.ListItems.Count <> 0 Then lvw.ListItems.Clear
dtaBackups.RecordSource = "SELECT * FROM Files ORDER BY Container_Volume"
rs.Open dtaBackups.RecordSource, dtaBackups.ConnectionString, adOpenKeyset, adLockOptimistic
rs.MoveFirst
Do While Not rs.EOF
If Not rs!Container_Volume = lvwVolumeList.SelectedItem Then Exit Do
lvw.ListItems.Add , , rs!FileName
rs.MoveNext
Loop
For i = 1 To lvw.ListItems.Count
rs.MoveFirst
rs.Find "Filename = '" & lvw.ListItems(i) & "'", 0, adSearchForward
If rs.EOF = True Then
Exit For
Else
lvw.ListItems(i).SubItems(1) = rs!Size
lvw.ListItems(i).SubItems(2) = rs!DateTime
End If
Next i
rs.Close
Set lvw = Nothing
Set rs = Nothing
End Sub
This sub will only work when there's one item in the listview. When there's more than one, it only works for the last item. Why is this?