(Solved) – Populating a report in ms access via vba

  • by

So I have a stored procedure in my database which i run from MS access using pass through query which returns a table.
I access the table using a recordset “rs”. I want to loop through the record set and for each row I want to create an instance of the report and populate the text boxes in the report.

For example I want a report for each student that will have his name, age, sex e.t.c. So it should be done by looping through the record set and creating a report for each student and filling in the textboxes. I wrote this code but to test for one textbox but have a strong feeling that I’m missing alot. Any help would be very much appreciated

 Dim i As Integer
i = 0

Do While Not rs.EOF
    Dim rtp(i) As Report_DecemberProject
    Set rpt(i) = New Report_DecemberProject
    rpt(i).Text55.Value = rs.Fields(3)
    rpt(i).Visible = True
    i = i   1

Leave a Reply

Your email address will not be published. Required fields are marked *