New report in loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sep410
    New Member
    • Jul 2008
    • 77

    New report in loop

    Hi all,
    I have a loop and my report open code is in this loop.How can I make access to open new report for each item in the loop when I run it?
    My code:
    Code:
     Dim rs As New ADODB.Recordset
        Dim strSql As String
       
       strSql = "SELECT DISTINCT tbl_Report.ReportMonth, tbl_Customer_Interest.CustomerID FROM tbl_Customer_Interest INNER JOIN tbl_Report ON tbl_Customer_Interest.ReportID = tbl_Report.ReportID WHERE (((tbl_Report.ReportMonth)='" & Me!cboMonth.Value & "'));"
       
        rs.Open strSql, CurrentProject.Connection
        
                If rs.EOF Then
                MsgBox ("This month does not have any record.")
                Exit Sub
                End If
        
        Do While Not rs.EOF
         stOpenDate = "(QryRptCustomer.ReportMonth)='" & cboMonth.Value & "' and (QryRptCustomer.CustomerId)=" & rs!CustomerId & ""
         DoCmd.OpenReport stDocName, acViewPreview, , stOpenDate
          rs.MoveNext
        Loop
Working...