Posted on 2003-11-19
I have a ADODB Recordset from a query with all the fields from the table at the SQL database. I only want to write some of the fields to a listview and I have an array with the names of the fields I want to show.
Code is as follows:
For i = 1 To RsLlista.RecordCount
Set mitem = .ListItems.Add
mitem.Text = RsLlista(arraycols(0)).Name
mitem.Tag = RsLlista!Id
For j = 1 To FLlista.ListView1.ColumnHeaders.Count - 1
mitem.SubItems(j) = RsLlista(array(j)).Name
Problem is that I get an error saying more or less (translation from Spanish) "Cannot find element from collection...".
If I write the name of a field i.e. RsLlista("NAME").Name, it works, but when VB has to get the name from a variable I have problems.
Any idea is welcome.
Thanks in advance,