Slow down Module

S

Sheila Jipping

I have a function that reads a list, based on the entries list prints an
Access report, and then prints a corresponding .pdf report based on the
entry. The function works except that the Access reports sometimes "beats"
the .pdf report. So instead having report, .pdf, report, .pdf, etc. I'll
end up with report, .pdf, report, .pdf, report, report, .pdf - often it
happens on the third loop but the fact that it happens at all is very
bothersome and throwing a huge monkey wrench into what I am trying to
accomplish.

Below is the loop code.....


Set qdf = CurrentDb.QueryDefs![MtoPrint]
qdf.Parameters![Enter MO number] = rst!MOnum
qdf.Execute

stDocName = "repMoo"
DoCmd.OpenReport stDocName, acViewNormal


pdfFile = rst!PrintNum

strShell = """C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe"" "
& "/p /h " & pdfFile
Shell strShell, vbHide
 
D

Dirk Goldgar

Sheila Jipping said:
I have a function that reads a list, based on the entries list prints
an Access report, and then prints a corresponding .pdf report based
on the entry. The function works except that the Access reports
sometimes "beats" the .pdf report. So instead having report, .pdf,
report, .pdf, etc. I'll end up with report, .pdf, report, .pdf,
report, report, .pdf - often it happens on the third loop but the
fact that it happens at all is very bothersome and throwing a huge
monkey wrench into what I am trying to accomplish.

Below is the loop code.....


Set qdf = CurrentDb.QueryDefs![MtoPrint]
qdf.Parameters![Enter MO number] = rst!MOnum
qdf.Execute

stDocName = "repMoo"
DoCmd.OpenReport stDocName, acViewNormal


pdfFile = rst!PrintNum

strShell = """C:\Program Files\Adobe\Acrobat
7.0\Reader\AcroRd32.exe"" " & "/p /h " & pdfFile
Shell strShell, vbHide

I haven't tried it myself, but a Google Groups search just now for "wait
for report to finish group:*.*access.*" turned up this thread, in which
one of the correspondents posted a simple function named
"WaitForReportClose" that may work for the purpose:
http://groups.google.com/group/micr...54c8af62fe4?lnk=st&q=&rnum=7#2fb4254c8af62fe4

It uses the built-in SysCmd function in a loop to wait for the report
whose name you pass it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top