Private Function GRD_AddLine(ByRef rrecRecord As ADODB.Recordset, ByVal vintOutlineLevel As Short) As Boolean On Error GoTo Error_GRD_AddLine Dim blnReturn As Boolean Dim intRow As Short Dim recRecord As New ADODB.Recordset blnReturn = True 'add the text to put in the tree grdCompte.AddItem(NullString) intRow = grdCompte.Rows - 1 If rrecRecord.Fields("Header").Value = 1 Then 'This line is a header grdCompte.set_IsSubtotal(intRow, True) 'Indicate the indentation of the line grdCompte.set_RowOutlineLevel(intRow, vintOutlineLevel) grdCompte.Cell(VSFlex7.CellPropertySettings.flexcpFontBold, intRow, 0, , grdCompte.Cols - 1) = True Else 'do nothing End If 'Feed the line with values grdCompte.TextMatrix(intRow, mintGRDCompte_col) = (rrecRecord.Fields("Description").Value If rrecRecord.Fields("Header").Value = 1 Then Call CloneRecordSet(rrecRecord, recRecord) 'Look if it's parent with other accounts. Then add those accounts. recRecord.Filter = NullString'My problem is here, my value stays the same while in vb6 it was automatically changing recRecord.Filter = "ID_Parent=" & rrecRecord.Fields("ID").Value Do While Not recRecord.EOF Call GRD_AddLine(recRecord, intOutlineLevel + 1) recRecord.MoveNext() Loop Else 'DONE ! End IfExit_GRD_AddLine: recRecord = Nothing GRD_AddLine = blnReturn Exit FunctionError_GRD_AddLine: blnReturn = False Resume Exit_GRD_AddLineEnd Function'-----------------Public Function CloneRecordSet(ByRef robjToClone As ADODB.Recordset, ByRef robjCloned As Object) As Boolean On Error GoTo Error_CloneRecordSet Dim blnReturn As Boolean Dim oStr As New ADODB.Stream() robjToClone.Save(oStr) Dim resRecordset As New ADODB.Recordset() 'open the stream object in a new recordset resRecordset.Open(oStr, , , robjToClone.LockType) 'return the recordset cloned robjCloned = resRecordset resRecordset = Nothing blnReturn = TrueExit_CloneRecordSet: CloneRecordSet = blnReturn Exit FunctionError_CloneRecordSet: blnReturn = False Resume Exit_CloneRecordSetEnd Function