Hi i am using the below code to print a bunch of reports by filtering them from an array and as the code runs it asks me for the parameter value of each portfolio.. any idea how to stop that prompt? thanks in advance!
Sub PrintReport()
Dim rsPort As Variant
Dim strSQL As String
Dim i As Integer
strSQL = "SELECT Table1.PORTFOLIO FROM Table1 GROUP BY Table1.PORTFOLIO"
Set rsPort = CurrentDb.OpenRecordset(strSQL)
With rsPort
Do While Not .EOF
i = 0
DoCmd.OpenReport "MAIN_SHEET2", acViewPreview, "Qry_Main_Wght2", "PORTFOLIO =" & rsPort(i)
DoCmd.OutputTo acOutputReport, "MAIN_SHEET2", acFormatPDF, "V:\myDocuments\Reports\DailyClient\" & rsPort(i) & "\" & rsPort(i) & Format(Date, "yyyymmddhhss") & ".pdf"
DoCmd.Close acReport, "MAIN_SHEET2", acSaveYes
i = 1 + i
.MoveNext
Loop
End With
rsPort.Close
End Sub
Sub PrintReport()
Dim rsPort As Variant
Dim strSQL As String
Dim i As Integer
strSQL = "SELECT Table1.PORTFOLIO FROM Table1 GROUP BY Table1.PORTFOLIO"
Set rsPort = CurrentDb.OpenRecordset(strSQL)
With rsPort
Do While Not .EOF
i = 0
DoCmd.OpenReport "MAIN_SHEET2", acViewPreview, "Qry_Main_Wght2", "PORTFOLIO =" & rsPort(i)
DoCmd.OutputTo acOutputReport, "MAIN_SHEET2", acFormatPDF, "V:\myDocuments\Reports\DailyClient\" & rsPort(i) & "\" & rsPort(i) & Format(Date, "yyyymmddhhss") & ".pdf"
DoCmd.Close acReport, "MAIN_SHEET2", acSaveYes
i = 1 + i
.MoveNext
Loop
End With
rsPort.Close
End Sub