1.11M Members

Multipage report

 
0
 
  1. database in access
  2. ADO is in use
  3. Datareport is designed.
  4. I have 40 records in Recordset.
  5. I want create one page per record in recordset.

It just create one page report for only first record

Private Sub Command1_Click()
Dim cnString As String
    Set rs = New ADODB.Recordset
    cnString = "Select * from Main"
    rs.Open cnString, cn, adOpenStatic, adLockOptimistic

    Set DataReport1.DataSource = rs
    If Not rs.EOF Then
        DataReport1.Sections(4).ForcePageBreak = rptPageBreakAfter
        DataReport1.Show
        rs.MoveNext
    End If
End Sub
 
0
 

Change this part...

Set DataReport1.DataSource = rs
    If Not rs.EOF Then
        DataReport1.Sections(4).ForcePageBreak = rptPageBreakAfter
        DataReport1.Show
        rs.MoveNext
    End If

to ...

    If Not rs.EOF Then
        Set DataReport1.DataSource = rs

        DataReport1.Sections(4).ForcePageBreak = rptPageBreakAfter
        DataReport1.Show
        rs.MoveNext
    End If

I am not sure why you would want to show 40 seperate report pages though. It will consume large amounts of pc performance. Why not rather open just the record you want to view?

 
0
 

Each record row contain marks of a student and I like to create a marksheet for each shudent as datareport page.

 
0
 

I see. No problem then.

Did my above answer solve the problem though?

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article