why twice fresh?
Code:
Private Sub APRI_LISTVIEW()
If Not (RS Is Nothing) Then
If (RS.State And adStateOpen) = adStateOpen Then RS.Close
Set RS = Nothing
End If
Screen.MousePointer = vbHourglass
Set RS = New ADODB.Recordset
RS.CursorLocation = adUseClient
RS.Open SQL, CON, adOpenForwardOnly, adLockReadOnly
'RS.Sort = ("DATA DESC, IDTAVOLO")
RS.MoveFirst
Erase STRDBROWS()
STRDBROWS = RS.GetRows()
RS.Close
Set RS = Nothing
With Me.LVTAVOLI
'LockWindowUpdate .hwnd
SendMessage .hwnd, WM_SETREDRAW, 0, ByVal 0
.Sorted = False
.Visible = False
.ListItems.Clear
For K = 0 To UBound(STRDBROWS, 2)
ID = STRDBROWS(11, K)
Set ITMX = .ListItems.Add(, , STRDBROWS(0, K))
'ITMX.SmallIcon = ID
'TAVOLO
ITMX.SubItems(1) = STRDBROWS(1, K)
'IDPIATTO
ITMX.SubItems(2) = STRDBROWS(2, K)
'NOME PIATTO
ITMX.SubItems(3) = STRDBROWS(3, K)
'REPARTO
ITMX.SubItems(4) = STRDBROWS(4, K)
ITMX.ListSubItems(4).ReportIcon = ID
'QTA
ITMX.SubItems(5) = STRDBROWS(5, K)
'PREZZO
ITMX.SubItems(6) = Format$(STRDBROWS(6, K), "#,##0.00")
'TOTALE
ITMX.SubItems(7) = Format$(STRDBROWS(7, K), "#,##0.00")
'DATA
ITMX.SubItems(8) = STRDBROWS(8, K)
'ORA
ITMX.SubItems(9) = STRDBROWS(9, K)
'DATA CANC
If Not IsNull(STRDBROWS(10, K)) Then
ITMX.SubItems(10) = STRDBROWS(10, K)
ITMX.ListSubItems(10).ForeColor = vbRed
End If
'ORA CANC
If Not IsNull(STRDBROWS(12, K)) Then
ITMX.SubItems(11) = STRDBROWS(12, K)
ITMX.ListSubItems(11).ForeColor = vbRed
End If
'IDNAME
If Not IsNull(STRDBROWS(13, K)) Then
ITMX.SubItems(12) = STRDBROWS(13, K)
Else
ITMX.SubItems(12) = ""
End If
ITMX.SubItems(13) = STRDBROWS(11, K)
If Not IsNull(STRDBROWS(14, K)) Then
ITMX.SubItems(14) = STRDBROWS(14, K)
Else
ITMX.SubItems(14) = ""
End If
Next K
Set ITMX = Nothing
Me.LNR.Caption = .ListItems.Count
.Visible = True
SendMessage .hwnd, WM_SETREDRAW, 1, ByVal 0
Screen.MousePointer = vbDefault
'LockWindowUpdate 0&
End With
End Sub