UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Access 2007: Achidden Not Working (?), Access 2007    
 
   
VladimirC
post Sep 16 2019, 09:42 AM
Post#1



Posts: 6
Joined: 15-September 19



Hello,

I'm trying to export multiple reports to PDF. The procedure is based on a recordset loop ie. there are more than one report to be exported to PDF.

CODE
With rs
      If Not (.BOF And .EOF) Then
         While Not .EOF
            strTrida = !TRIDA
            gFilter = "Trida = '" & strTrida & "'"

            For u = LBound(sestavy) To UBound(sestavy)

               strSestava = sestavy(u)
               strSoubor = strSestava
               gPrehledy = strSoubor Like "*Prehled*"
               strSoubor = Mid(strSoubor, 4) & "_" & Replace(strTrida, ".", "") & ".PDF"
               strSoubor = strCesta & strSoubor

               DoCmd.OpenReport strSestava, acViewPreview, , gFilter, acHidden
               DoCmd.OutputTo acOutputReport, strSestava, acFormatPDF, strSoubor
               DoCmd.Close acReport, strSestava
               DoEvents

            Next u

            .MoveNext
            DoEvents
         Wend
      End If

   End With



The code generates 20 reports (according to rs.RecordCound).

As you can see, I've added acHidden to prevent every report from appearing on the screen. Unfortunately, acHidden seems to be ignored by MS Access 2007. Not sure whether it's due to locale settings (CZ) plus Czech version of MS Access.

I've also tried the following...

CODE
Dim r as Report

               DoCmd.OpenReport strSestava, acViewPreview
               Set r = Reports(strSestava)
               r.Visible = False


... but it didn't help either, ie. the screen was blinking (showing up each report).

Is there any workaround, please?

Thank you very much in advance.
This post has been edited by VladimirC: Sep 16 2019, 09:49 AM
Go to the top of the page
 
ADezii
post Sep 17 2019, 02:32 PM
Post#2



Posts: 2,679
Joined: 4-February 07
From: USA, Florida, Delray Beach


Try replacing acHidden with acIcon which will Minimize the Report Window in the TaskBar. Just an idea.
Go to the top of the page
 
projecttoday
post Sep 17 2019, 05:01 PM
Post#3


UtterAccess VIP
Posts: 11,082
Joined: 10-February 04
From: South Charleston, WV


Have you tried eliminating Docmd.OpenReport and Docmd.Close ?

--------------------
Robert Crouser
Go to the top of the page
 
VladimirC
post Sep 18 2019, 11:05 AM
Post#4



Posts: 6
Joined: 15-September 19



I'm sorry, icIcon has the effect, ie. none. I think it's due to bad design of OutputTo & acFormatPDF. Either way, acHidden and icIcon don't work as expected, as if they were ignored. Does any of these work on your machine(s)?
Go to the top of the page
 
VladimirC
post Sep 18 2019, 11:23 AM
Post#5



Posts: 6
Joined: 15-September 19



I'm sorry, I have no idea how to eliminate Docmd.OpenReport and Docmd.Close.

The interesting point is that I can export a report to PDF with no extra window/ flash / blink just by the following:

CODE
   DoCmd.OutputTo acOutputReport, strSestava, acFormatPDF, strSoubor


Ie. no DoCmd.Open, DoCmd.Close. The problem is that if I put it in the loop the code execution breaks immediately after the first export is finished. No error mesage, nothing, it simply breaks code execution. Same behavior when I try

CODE
   DoCmd.OutputTo acOutputReport, "myReport1", acFormatPDF, "D:\test\test1.pdf"
   DoCmd.OutputTo acOutputReport, "myReport2", acFormatPDF, "D:\test\test2.pdf"
   DoCmd.OutputTo acOutputReport, "myReport3", acFormatPDF, "D:\test\test3.pdf"



Weird, isn't it?

Go to the top of the page
 
projecttoday
post Sep 18 2019, 03:40 PM
Post#6


UtterAccess VIP
Posts: 11,082
Joined: 10-February 04
From: South Charleston, WV


I don't know that I would call it weird.

The only other suggestion I have is

DoCmd.OutputTo acOutputReport, "myReport1", acFormatPDF, "D:\test\test1.pdf"
Do Events
DoCmd.OutputTo acOutputReport, "myReport2", acFormatPDF, "D:\test\test2.pdf"

But you may have already tried that.

--------------------
Robert Crouser
Go to the top of the page
 
VladimirC
post Sep 18 2019, 04:39 PM
Post#7



Posts: 6
Joined: 15-September 19



It doesn't help either. Code execution breaks after

CODE
   DoCmd.OutputTo acOutputReport, "myReport1", acFormatPDF, "D:\test\test1.pdf"


and it doesn't step to the next command, no matter what it is.


I have also tried the following:

CODE
   DoCmd.OutputTo acOutputReport, "myReport1", acFormatPDF, "D:\test\test1.pdf"
   DoCmd.Close acOutputReport, "myReport1"


No success, of course. iconfused.gif
This post has been edited by VladimirC: Sep 18 2019, 04:41 PM
Go to the top of the page
 
projecttoday
post Sep 18 2019, 07:14 PM
Post#8


UtterAccess VIP
Posts: 11,082
Joined: 10-February 04
From: South Charleston, WV


Last last suggestion: change

DoCmd.OutputTo acOutputReport, "myReport1", acFormatPDF, "D:\test\test1.pdf"
DoCmd.OutputTo acOutputReport, "myReport2", acFormatPDF, "D:\test\test2.pdf"

to

DoCmd.OutputTo acOutputReport, "myReport2", acFormatPDF, "D:\test\test2.pdf"
DoCmd.OutputTo acOutputReport, "myReport1", acFormatPDF, "D:\test\test1.pdf"


--------------------
Robert Crouser
Go to the top of the page
 
VladimirC
post Sep 19 2019, 06:39 AM
Post#9



Posts: 6
Joined: 15-September 19



Unfortunately, it does not work either.

I'd like to thank you very much for your time & for all your suggestions. thanks.gif

I'll keep trying & I'll post my solution as soon as I find it.
This post has been edited by VladimirC: Sep 19 2019, 06:53 AM
Go to the top of the page
 
projecttoday
post Sep 19 2019, 06:55 AM
Post#10


UtterAccess VIP
Posts: 11,082
Joined: 10-February 04
From: South Charleston, WV


But what happened? Did Report2 run correctly?

--------------------
Robert Crouser
Go to the top of the page
 
VladimirC
post Sep 19 2019, 12:38 PM
Post#11



Posts: 6
Joined: 15-September 19



Excuse me, pls...
Yes, the first PDF in the queue (D:\test\test2.pdf) has been created.

In these circumstances I'm thinking of dynamic string that could be executed as a function via Eval. Not sure whether this could be done in Access since the string must contain full code, incl. "header" and "footer". Thus it might not work.

I'll let you know when I succeed.
This post has been edited by VladimirC: Sep 19 2019, 12:41 PM
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    22nd October 2019 - 04:41 AM