I am not seeing a way to be more efficient with memory. The only thing I can think of is to have the code pause. At least, this will help us to determine if it is a memory issue.
Add a procedure to your module. Paste all of the following code as a stand-alone private sub.
Code:
Private Sub pleaseWait(intDelay As Integer)
Dim dblDelayTill As Double
dblDelayTill = DateAdd("s", intDelay, Now)
While DateDiff("s", Now, dblDelayTill) > 0: Wend
End Sub
Then you can call the sub from within your code. Here, I am using 2 seconds. I suggest using 2 seconds and then revisit how we can do better at a later time.
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim StrFileName As String
Dim mypath As String
Dim temp As String
mypath = "C:\Antipsychotics Testing\PC"
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT[ALTIDFILE] FROM [DOC_AP_MASTER]", dbOpenSnapshot)
While Not rs.EOF
temp = rs![ALTIDFILE]
StrFileName = temp & ".PDF"
DoCmd.OpenReport "Physician Summary", acViewReport, , "[ALTIDFILE]= '" & temp & "'"
DoCmd.OutputTo acOutputReport, "", acFormatPDF, mypath & StrFileName
Call pleaseWait(2)
DoCmd.Close acReport, "Physician Summary"
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
Set db = Nothing