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 vendor, exported by vendor# to the C drive.
I have a report 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....
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
The error I receive is;
Run Time Error '3075'
Syntax error in date in query expression 'VENDOR# = A0055'.
A0055 is one of the vendors listed in my table.
Help!