PDA

Click to See Complete Forum and Search --> : ListView Code


davidrobin
Aug 28th, 2000, 04:29 PM
I need to confirm what you are asking to help you as specifically as possible.

Firstly I presume you are using the listview in report style (rows and columns).

You have 2 recordsets and a listview control. You want to display the first column of the second recordset. What position will this column be in the listview in relation to the other columns from the first recordset? and you want to display all but the first column of the first recordset. Is there some link between these recordsets?

TimC
Aug 29th, 2000, 09:01 AM
I figured it out. The Listview was showing the two queries at different times, depending on which one they wanted to see, not at the same time. I was having trouble getting the first column to show on the second query, because the code was written to not show the first column on the first query. I had to figure out how to add the columnheader and then the data for the second query. I figured that out, it only need to have a few changes, and then used an IF statement to direct the queries to the correct code. The code for the second query is now:

For i = 0 To rsListData.Fields.Count - 1
Me.ctlViewCust.ColumnHeaders.Add _
, _
"Column" & i, _
rsListData.Fields(i).Name
Next i

If Not rsListData.EOF Then
sEditID = rsListData.Fields(0)
End If


Do While Not rsListData.EOF
Set itemReturned = Me.ctlViewCust.ListItems.Add( _
, _
"Item" & rsListData.Fields(0), _
rsListData.Fields(0))
For i = 1 To rsListData.Fields.Count - 1

itemReturned.SubItems(i) = _
rsListData.Fields(i) & ""
Next i
rsListData.MoveNext

Loop


Not much of a change, just needed to figure what little changes to make. Thanks anyway!