I have a temp folder for each user and when they create reports, code deletes the temp files and exports a new one.
Something like this
Code:
Dim strPath As String
Dim strKill As String
strPath = "C:\Test"
strKill = Dir(strPath & "*.pdf", vbHidden)
'Delete the temporary files
While strKill <> ""
Kill strPath & strKill
strKill = Dir(strPath & "*.pdf", vbHidden)
Wend
DoCmd.OutputTo acOutputReport, "rptReportName", acFormatPDF, strPath & "\FileName.PDF"
Application.FollowHyperlink strPath & "\FileName.pdf", , True
I have additional code that checks for and generates the temp folder. I also have code that checks if the user has one of the PDF's open before the app tries to delete it.