Hi Everyone,

First let me say I'm new to VB and to the forum so I wasn't sure if I should attached my problem to a previous thread "[Resolved] data reports with unbound controls" as it was already resolved.

I am using Windows 98, VB6, Access 2000

I created a report (rptResults) with unbound textboxes and want to populate it with records from an ADO recordset.

I used the example from the previous thread and here is my code:

VB Code:
  1. Set RptResults.DataSource = adoResults.Recordset.Datasource
  2.      With rptResults
  3.           With .Sections ("Section1").Controls
  4.                For i = 1 To .Count
  5.                     If TypeOf .Item(i) Is RptTextBox Then
  6.                     .Item(i).DataMember = ""
  7.                     [COLOR=Red].Item(i).DataField = adoResults.Recordset.Fields(i).Name[/COLOR]
  8.                     End If
  9.                Next i
  10.           End With
  11.      End With
  12. rptResults.show
  13. End Sub

I get the following error:

ADO could not find the object in the collection corresponding to the name or ordinal reference requested by the application.

The red line is the line generating the error.

Can someone please help?