I don't get that prompt from Access 2007 SP3 when adapting your OutputTo
with the name of my report object and giving it a valid file path for OverViewFile. So I suspect your problem is due to OverViewFile; inspect the value of that string:
OverViewFile = DLookup("ExportPath", "dbo_Defaults") & "PC" & Format(Now(), "ddmmyy") & Format(Now(), "hhmm") & ".pdf"
Debug.Print OverViewFile
DoCmd.OutputTo acOutputReport, "Rpt_ExportBPC", acFormatPDF, OverViewFile, False
You can view the output from Debug.Print
in the Immediate window (Ctrl+g will take you there).
Perhaps DLookup
is returning Null. You would then have a valid VBA string for OverViewFile, but it would not be a valid Windows path.
There is another issue with OverViewFile which probably doesn't contribute to the problem, but I'll suggest this because it's simpler and I think you actually want hhnn instead of hhmm in the file name (n represents minute; m represents month)
OverViewFile = DLookup("ExportPath", "dbo_Defaults") & "PC" & _
Format(Now(), "ddmmyyhhnn") & ".pdf"