I have recordset with city, zipcode, and location.
during the a loop, possible to have the result in a listview, with a column name CITY, ZIPCOD, LOCATION, CITY1, ZIPCOD1, LOCATION1, with this sequence, similar, the attached sheet.
fill LISTVIEW WITH CITY, LOCATION AND ZIP
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
fill LISTVIEW WITH CITY, LOCATION AND ZIP
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
I'll assume that you have already opened a recordset named rst, and that you have a listview control named ListView1.
Code: Select all
Dim lvw As ListView
Dim itm As ListItem
Dim i As Long
Dim n As Long
rst.MoveLast
rst.MoveFirst
n = rst.RecordCount
Set lvw = Me.ListView1
For i = 1 To n - 1
Set itm = lvw.ListItems.Add(Text:=rst!CITY)
itm.ListSubItems.Add Text:=rst!ZIPCOD
itm.ListSubItems.Add Text:=rst!Location
rst.MoveNext
itm.ListSubItems.Add Text:=rst!CITY1
itm.ListSubItems.Add Text:=rst!ZIPCOD1
itm.ListSubItems.Add Text:=rst!Location1
Next i
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
Sorry, but changed my code....
instead a recordset have this array, can you rearrange?
NOTE:
the controls are combobox
instead a recordset have this array, can you rearrange?
Code: Select all
For R = 1 To A
If Me.Controls("LOC" & R).Text > "" Then
ReDim Preserve RouteL(R)
With RouteL(I)
CITTA = Split(Me.Controls("CIT" & R).Text, "-(")(0)
ZIP= Replace(Split(Me.Controls("CIT" & R).Text, "-(")(1), ")", "")
LOCALITA = Split(Me.Controls("LOC" & R).Text, "-")(1)
'LATD = Replace(Split(Me.Controls("LOC" & R).Text, "-")(2), ".", ",")
'LOND = Replace(Split(Me.Controls("LOC" & R).Text, "-")(3), ".", ",")
End With
End If
Next
the controls are combobox
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
You don't do anything with RouteL(I) so I don't understand what you're doing now.
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
It doesn't make sense. You don't do anything with RouteL(I) in
With RouteL(I)
...
End With
With RouteL(I)
...
End With
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
ops....
see the image.
i need to store the value from each combobox value in array
CITTA = Split(Me.Controls("CIT" & R).Text, "-(")(0)
PR= Replace(Split(Me.Controls("CIT" & R).Text, "-(")(1), ")", "")
LOCALITA = Split(Me.Controls("LOC" & R).Text, "-")(1)
see the image.
i need to store the value from each combobox value in array
CITTA = Split(Me.Controls("CIT" & R).Text, "-(")(0)
PR= Replace(Split(Me.Controls("CIT" & R).Text, "-(")(1), ")", "")
LOCALITA = Split(Me.Controls("LOC" & R).Text, "-")(1)
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
I don't understand this at all, sorry.
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
Hi bro!
Attached new xls with the position of value in combobox, similar the listview in image.
In effect i need to loop the value in combobox ans paste in listview.
Attached new xls with the position of value in combobox, similar the listview in image.
In effect i need to loop the value in combobox ans paste in listview.
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
How have the combo boxes been populated?
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
txt code
button draw start all (command1)
button draw start all (command1)
You do not have the required permissions to view the files attached to this post.
-
- PlatinumLounger
- Posts: 4368
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78586
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: fill LISTVIEW WITH CITY, LOCATION AND ZIP
The code is far too long for me to analyze, but it seems to me you already use recordsets to populate the combo boxes, so why not use those to populate the listview?
Best wishes,
Hans
Hans