Till now I managed to publish and save all in C:\Reports. What I'm trying to do is Save to path specified in Path. DB attached.
Private Sub PrintAll_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim MyPath As String
Dim MyFileName As String
Dim MyProjectNumber As String
Dim MyProjectName As String
MyPath = "C:\Reports\"
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT ProjectNumber,ProjectName FROM Master", dbOpenDynaset)
With rs
Do While Not .EOF
MyProjectNumber = !ProjectNumber
MyProjectName = !ProjectName
MyFileName = MyProjectNumber & " " & MyProjectName & ".PDF"
DoCmd.OpenReport "Total Report", acViewPreview, , "ProjectNumber='" & !ProjectNumber & "'"
DoCmd.OutputTo acOutputReport, "Total Report", acFormatPDF, MyPath & MyFileName
DoCmd.Close acReport, "Total Report"
.MoveNext
Loop
End With
Set rs = Nothing
Set db = Nothing
End Sub