Hi All -
Am having a problem printing a large collection of existing PDF files in Access. Have used the folowing code in a loop feeding it filenames and things seem to work ok, except not all PDF files print. It tends to print a group of say 4 or 5 documents, skips some, prints some more, and so on. It also leaves multiple copies of Adobe open but still closes the majority of them. I'm thinking it must have something to do with the speed it is sending the commands to Adobe. I tried setting the wait arguments for sendkeys to true and putting a delay loop in, nothing seemed to help. Anyone have any ideas?
rs.MoveFirst
While i <= lNumrec
sFilePath = "\\glfsmalld2\MapX\Images\" + rs.Fields("clientnum").Value + "\"
sFileName = rs.Fields("clientnum").Value & rs.Fields("date").Value & ".PDF"
'print PDF
Application.FollowHyperlink sFilePath + sFileName
SendKeys "%(FP)"
SendKeys "~", True
SendKeys "^q" 'Quits Adobe
i = i + 1
rs.MoveNext
Wend
Am having a problem printing a large collection of existing PDF files in Access. Have used the folowing code in a loop feeding it filenames and things seem to work ok, except not all PDF files print. It tends to print a group of say 4 or 5 documents, skips some, prints some more, and so on. It also leaves multiple copies of Adobe open but still closes the majority of them. I'm thinking it must have something to do with the speed it is sending the commands to Adobe. I tried setting the wait arguments for sendkeys to true and putting a delay loop in, nothing seemed to help. Anyone have any ideas?
rs.MoveFirst
While i <= lNumrec
sFilePath = "\\glfsmalld2\MapX\Images\" + rs.Fields("clientnum").Value + "\"
sFileName = rs.Fields("clientnum").Value & rs.Fields("date").Value & ".PDF"
'print PDF
Application.FollowHyperlink sFilePath + sFileName
SendKeys "%(FP)"
SendKeys "~", True
SendKeys "^q" 'Quits Adobe
i = i + 1
rs.MoveNext
Wend