Public Sub viewlistaoperai()
Dim lst As ListItem 'dim a listitem
Dim i As Integer 'loop
With Me.ListView1 'reference
.Checkboxes = True 'show with check boxes
.MultiSelect = True 'allow multi-selection
.HideSelection = False 'keep selection when lost focus
.FullRowSelect = True 'select the full row
.GridLines = True 'show grid lines
.View = lvwReport 'show details
'.Icons = Me.ImageList1(1) 'use this for large icons
'.SmallIcons = Me.ImageList1(0) 'for small ones
.ColumnHeaders.Add 'add a couple columns
.ColumnHeaders.Add
.ColumnHeaders(1).Text = "Nome e Cognome" 'name the columns
.ColumnHeaders(1).Width = .Width * 0.98 'column width based on width of list view
.ColumnHeaders(2).Text = ""
.ColumnHeaders(2).Width = .Width * 0
'.Arrange = lvwAutoLeft
For i = 1 To 30 'add some sample items
.ListItems.Add 1, "K" & i, "Some Text " & Format$(i, "00")
Set lst = .ListItems("K" & i) 'now work with the item
With lst
If i Mod 2 Then 'alternate the text and icons
'.Icon = "ie icon"
'.SubItems(1) = "Internet Explorer " & Format$(i, "00")
Else
'.Icon = "computer icon"
'.SubItems(1) = "Computer " & Format$(i, "00")
End If
'.SmallIcon = .Icon
End With
Next
.SortKey = 0 'first column
.Sorted = True 'sort it
.ListItems(1).Selected = True 'select the first one
.ListItems(1).EnsureVisible 'make sure it is visible
.ListItems(1).Checked = True 'check this one as well
'Text4 = Val(Text4.Text) + Val(1)
End With
'For Each itm In Me.ListView1.ListItems
' itm.Checked = bValue
'Next
'--inizio listaoperai access-------------------------------------------------------------------------
Dim cnviewtransac As New ADODB.connection
Dim rsviewtransac As New ADODB.recordset
Dim tot, X
Call connection(cnviewtransac, App.Path & "\db1.mdb", "rbp")
Call recordset(rsviewtransac, cnviewtransac, "SELECT * FROM listaoperai WHERE nomecognome")
ListView1.ListItems.clear
With rsviewtransac
While Not .EOF
Set X = ListView1.ListItems.Add(, , .Fields!Nomecognome)
X.SubItems(1) = .Fields!Nomecognome
.MoveNext
Wend
End With
'Text18.Text = tot
Set cnviewtransac = Nothing
Set rsviewtransac = Nothing
'---fine listaoperai access --------------------------------------------------------------------------
End Sub
Private Sub wievoreoperai()
Dim cnloadclientz As New ADODB.connection
Dim rsloadclientz As New ADODB.recordset
Call connection(cnloadclientz, App.Path & "\db1.mdb", "rbp")
'Call recordset(rsloadclientz, cnloadclientz, "SELECT * FROM oreoperai ORDER BY IDg ASC")
Call recordset(rsloadclientz, cnloadclientz, "SELECT * FROM oreoperai WHERE idg='" & Combo1.Text & "'")
With rsloadclientz
While Not .EOF
'.Fields!Nomecognome
'ListView1.ListItems.Add = .Fields!Nomecognome
ListView1.ItemCheck = .Fields!Nomecognome
.MoveNext
Wend
End With
Set cnloadclientz = Nothing
Set rsloadclientz = Nothing
End Sub