A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

OnFormat action not executed when exporting to PDF



 
 
Thread Tools Display Modes
  #1  
Old August 19th, 2009, 09:50 PM posted to microsoft.public.access.reports
Hakan Naslund
external usenet poster
 
Posts: 2
Default OnFormat action not executed when exporting to PDF

I have some reports that utilize the section onformat action to change a
textbox's fontweight depending on field value... This works great both on
report print and preview!

With 2007 SP1, we have the ability to create pdf's directly from access
which is great! But it seems that the onformat code is not executed in this
case...!

To reproduce, we can make a simple report:

create an emtpy report in design mode.
add 2 text boxes.
set the control source to ="TEXT" for both.
on one of the controls onformat event, add code to make the text bold:
Me.Text1.FontWeight=1000

Save the report as Report1.

if you open the report in print preview (or if you print it), you'll see
that one of the "TEXT" messages are in bold.

Now, open the vba editor and in the direct window type:
docmd.OutputTo acOutputReport
,"Report1",acFormatPDF,"c:\Report1.pdf",true,,,acE xportQualityPrint
A pdf file is created and opened in your pdf viewer. Notice that this time,
none of the text boxes are in bold!

Is this by design or is it a bug? Any ideas how to get around it?
  #2  
Old August 21st, 2009, 03:29 AM posted to microsoft.public.access.reports
Rob Parker[_4_]
external usenet poster
 
Posts: 30
Default OnFormat action not executed when exporting to PDF

Hi Hakan,

I tried your test case, and found that with Me.Text1.FontWeight=1000 I got
the behaviour you describe. However, if I change that to
Me.Text1.FontWeight=700 (using the value given in the help file for
enumeration of the Bold constant), then the PDF file (and the print preview)
does show bold text.

HTH,

Rob


"Hakan Naslund" wrote in message
...
I have some reports that utilize the section onformat action to change a
textbox's fontweight depending on field value... This works great both on
report print and preview!

With 2007 SP1, we have the ability to create pdf's directly from access
which is great! But it seems that the onformat code is not executed in
this
case...!

To reproduce, we can make a simple report:

create an emtpy report in design mode.
add 2 text boxes.
set the control source to ="TEXT" for both.
on one of the controls onformat event, add code to make the text bold:
Me.Text1.FontWeight=1000

Save the report as Report1.

if you open the report in print preview (or if you print it), you'll see
that one of the "TEXT" messages are in bold.

Now, open the vba editor and in the direct window type:
docmd.OutputTo acOutputReport
,"Report1",acFormatPDF,"c:\Report1.pdf",true,,,acE xportQualityPrint
A pdf file is created and opened in your pdf viewer. Notice that this
time,
none of the text boxes are in bold!

Is this by design or is it a bug? Any ideas how to get around it?


  #3  
Old August 27th, 2009, 07:03 AM posted to microsoft.public.access.reports
Hakan Naslund
external usenet poster
 
Posts: 2
Default OnFormat action not executed when exporting to PDF

Ahh, thanks Rob!

I will try that! Strange behaviour though...

Hakan

"Rob Parker" wrote:

Hi Hakan,

I tried your test case, and found that with Me.Text1.FontWeight=1000 I got
the behaviour you describe. However, if I change that to
Me.Text1.FontWeight=700 (using the value given in the help file for
enumeration of the Bold constant), then the PDF file (and the print preview)
does show bold text.

HTH,

Rob


"Hakan Naslund" wrote in message
...
I have some reports that utilize the section onformat action to change a
textbox's fontweight depending on field value... This works great both on
report print and preview!

With 2007 SP1, we have the ability to create pdf's directly from access
which is great! But it seems that the onformat code is not executed in
this
case...!

To reproduce, we can make a simple report:

create an emtpy report in design mode.
add 2 text boxes.
set the control source to ="TEXT" for both.
on one of the controls onformat event, add code to make the text bold:
Me.Text1.FontWeight=1000

Save the report as Report1.

if you open the report in print preview (or if you print it), you'll see
that one of the "TEXT" messages are in bold.

Now, open the vba editor and in the direct window type:
docmd.OutputTo acOutputReport
,"Report1",acFormatPDF,"c:\Report1.pdf",true,,,acE xportQualityPrint
A pdf file is created and opened in your pdf viewer. Notice that this
time,
none of the text boxes are in bold!

Is this by design or is it a bug? Any ideas how to get around it?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.