Hi There,
I'm having a problem with a module I wrote and I am hoping someone can help.
What I am Trying to Achieve - A separate report for each distinct vendor, exported by vendor#. My source data has 3 lines for the same vendor# and therefore produces a separate report for each line of data. The reports are identical. How do I just export one report for each Vendor#?
My report is based on a table called 'MT_SC_S15_FINAL_TABLE'. It is being grouped by the VENDOR#.
I have another table with is called 'EDISPATCH_TOWERS'. This table has a list of all my Vendor #'s. Actually both tables include the Vendor #.
Now this is the code I have written....
Code:
Option Compare Database
Function exp()
Dim rsDat As Recordset
Set rsDat = CurrentDb.OpenRecordset("Select [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
Help!