Hi. I have some code that loops through some items and prints out a pdf for
each item. My printer is defaulted to Adobe. This usually works just fine.
However, I now have a pretty big report that's composed of about 20
subreports. When I try to print the report using the code excerpt below, it
seems as if the code is executing before the report actually prints using the
Acrobat distiller. Any thoughts? Thanks!!
DoCmd.OpenReport "ProductSummary", acViewNormal
DoCmd.Close acReport, "ProductSummary", acSaveYes
Hi Mike,
I don't know if this will work, but have you tried using a DoEvents statement?
DoCmd.OpenReport "ProductSummary", acViewNormal
DoEvents
DoCmd.Close acReport, "ProductSummary", acSaveYes
or, possibly this:
Dim i as integer
DoCmd.OpenReport "ProductSummary", acViewNormal
For i = 1 to 50 '<---Experiment with top number
DoEvents
Next i
DoCmd.Close acReport, "ProductSummary", acSaveYes
Another possible fix might be to force the main report to read a value from
your open form, even though you won't use it for anything. In the report's
open event procedure, try something like this:
Dim strParam As String
strParam = Forms!NameOfYourForm!NameOfHiddenTextbox
Tom Wickerath
Microsoft Access MVP
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
> Hi. I have some code that loops through some items and prints out a pdf for
> each item. My printer is defaulted to Adobe. This usually works just fine.
[quoted text clipped - 5 lines]
> DoCmd.OpenReport "ProductSummary", acViewNormal
> DoCmd.Close acReport, "ProductSummary", acSaveYes