Just a guess, but I think Zick may be a user of google translate or something similar. Hence the odd wording.
Based on this:
Dim query As String
For Each item As ListViewItem In ListView1.Items
query = "Select * from [Calls and Visits$] where AM like '" & item.SubItems(1).Text & "%'"
'execute the query and do something with the results
Next
and this
after finding all the AM in the listview1 to listview2 i will sum all their calls and visits by Month (January to December)
I believe that he wants to search ListView2 for each "AM" entry in ListView1 and compute a yearly "Call" and "Visits" total per "AM" entry.
Perhaps Something Like this:
Private Sub Test()
' make some data
Dim LV1Source As New DataTable
Dim r As DataRow
With LV1Source
.Columns.Add("AM", GetType(String))
.Columns.Add("Code Name", GetType(String))
.Columns.Add("Department", GetType(String))
.Columns.Add("Status", GetType(String))
r = .NewRow : r(0) = "fred" : r(1) = "Something" : .Rows.Add(r)
r = .NewRow : r(0) = "barney" : r(1) = "Something" : .Rows.Add(r)
End With
Dim LV2Source As New DataTable
With LV2Source
.Columns.Add("AM", GetType(String))
.Columns.Add("Total Calls", GetType(Int32))
.Columns.Add("Total Visits", GetType(Int32))
.Columns.Add("Month", GetType(String))
.Columns.Add("Year", GetType(Int32))
r = .NewRow : r(0) = "fred" : r(1) = 10 : r(2) = 5 : r(3) = "January" : r(4) = 2011 : .Rows.Add(r)
r = .NewRow : r(0) = "fred" : r(1) = 10 : r(2) = 5 : r(3) = "February" : r(4) = 2011 : .Rows.Add(r)
r = …