Hello sdc,
I saw your post here and though I can't see the records in the database, I do see something interesting. Notice the "MyPath" variable in your code, which sets the location for the output path. Your code says:
Code:
...
... Some code here
...
Dim MyPath As String
Set rs = CurrentDb.openrecordset("unique_programs_distinct" )
rs.MoveFirst
Do Until rs.EOF = True
pdfName = "Report_" & rs("program") & ".pdf"
MyFilter = "Unique_Programs_Distinct.Program ='" & rs("program") & "'"
MyPath = rs("path")
...
... Some more code here
...
Rem -- Get the directory of the database
sCurrentDir = MyPath
...
... Some more code here
...
Rem -- Configure the PDF printer
With oPrinterSettings
Rem -- Set the destination file name of the PDF document
.SetValue "output", MyPath & pdfName
Anyway, from this code, it looks like you are getting the "folder path" from the "path" field in the Recordset, as shown in your code:
Code:
MyPath = rs("path")
But you are getting the name of the PDF file from the "program" field in the recordset, in the code:
Code:
pdfName = "Report_" & rs("program") & ".pdf"
So, definitely pay close attention to these pieces when trying to debug this problem. A couple of things I would check:
1. How is the "unique_programs_distinct" Recordset created?
2. Did you check the "unique_programs_distinct" Recordset to make sure that the Folder Path and the File Names match up correctly?
Otherwise, this code would seem to do what you say it should, though I don't have any access to the data directly to see the actual output. Those would be my thoughts about where to look to solve the problem, so I hope that is helpful! And, let me know if there is anything else I can do to help...
Good luck,
Geoffrey L. Griffith
http://www.ImagineThought.com
Wrox Author of:
Access 2010 24-Hour Trainer
Access 2010 Programmer's Reference
Access 2007 VBA Programmer's Reference