Currently, I have a report that is grouped at a vendor# level and is producing the same report three times for each vendor. There are 3 lines of data in the source data for each vendor and this is why the report is producing 3 reports for each vendor. Unfortunately, there is really nothing I can do to change the data. I wrote it in SQL and brought it into Access in order to produce the report.
My question is that since the report is repeated 3 times for each vendor, is there a way only to export the first page of the report for each vendor?
Here is my code;
Option Compare Database
Function exp()
Dim rsDat As Recordset
Set rsDat = CurrentDb.OpenRecordset("Select distinct [VENDOR#] From [EDISPATCH_TOWERS]")
rsDat.MoveFirst
Do
DoCmd.OpenReport "rpt_scorecards", acViewPreview, , "[VENDOR#] = '" & rsDat(0) & "'"
DoCmd.OutputTo acOutputReport, "rpt_scorecards", acFormatPDF, "C:\ACCOUNT_" & rsDat(0) & ".pdf"
DoCmd.Close acReport, "rpt_scorecards", acSaveNo
rsDat.MoveNext
Loop Until rsDat.EOF
MsgBox "Tower Scorecards Exported"
End Function
cross-post http://www.access-programmers.co.uk/...d.php?t=227615