P
PGC_Developer
Access 2007 Print Preview Export blows up when used in a program.
Posted previously on 6/1
I have several applications developed in Access 2000. In these applications
a
user can select a menu option to generate a report. The user is then
presented with the choice of directly printing the report or previewing the
report. When the
user selects preview, they are presented with a preview of the report with a
custom ToolBar and MenuBar that allows for changing zoom levels and allows
them the standard built in Access capability to publish the report to Word or
analyze with Excel. This preview is instantiated in code. The MenuBar and
the ToolBar are custom and set in code prior to the preview being made
visible.
When the user publishes to Word, an RTF type document is generated. The
user can then modify, save, or email the document as needed. This internal
Access capability has worked fine in 97, 2000, and 2003.
With Access 2007 the user can preview and print the report as they did in
the previous versions of Access. The publish button is available and
contains and looks to provide the same capabilities, the same selections are
available. The problem is that when the user actually says to Publish It to
MS Word, the program (Access 2007) blows up.
When you manually preview a report via the Access 2007 GUI, you can "Export"
the preview to different formats. In the case of Word, you are prompted for
a file name, and whether, or not, it should be opened by Word. This prompt
is not presented when the preview is instantiated in code as describe above.
Dim rpt As Report
gfPauseForPreview = True
'Declare and instantiate a copy of the report as defined in the "reports"
collection.
Set rpt = New Report_rpt_Areport
'Modify properties of the instantiated report.
rpt.Toolbar = "cstm_Print_Preview_Toolbar"
rpt.Caption = "Preview of: ArReport"
rpt.MenuBar = " "
rpt.MenuBar = "cstm_Print_Preview_Menu"
'Make the preview visible
rpt.VISIBLE = True
On Error GoTo AfterPause
Do While gfPauseForPreview
DoEvents
Loop
AfterPause:
Set rpt = Nothing
gfPauseForPreview is a public variable the is set to TRUE prior to the
report being made visible. After the report is made visible, a loop is
started to prevent the "rpt" object from going out of scope. When the user
is done with the preview, the "Close" event of the report changes the visible
property to false and sets the gfPauseForPreview to false, allowing the code
calling the preview to continue.
I need this functionality to be available in these applications. This is
used in several applications deployed within my agency. Having the ability
to publish to Word and then email reports save a lot of time.
I ran into a similar situation where Access 2007 was instantiating Word to
perform a mail merge. When done manually, a security prompt would be
presented. When done programmatically, the prompt would not be present and
the merge would not happen. This was addressed by MS KB 825765. Adding a
registry key turned the security prompt off. Is there a similar registry key
for the prompt present by Access 2007?
Any help would be greatly appreciated.
Thank you.
Posted previously on 6/1
I have several applications developed in Access 2000. In these applications
a
user can select a menu option to generate a report. The user is then
presented with the choice of directly printing the report or previewing the
report. When the
user selects preview, they are presented with a preview of the report with a
custom ToolBar and MenuBar that allows for changing zoom levels and allows
them the standard built in Access capability to publish the report to Word or
analyze with Excel. This preview is instantiated in code. The MenuBar and
the ToolBar are custom and set in code prior to the preview being made
visible.
When the user publishes to Word, an RTF type document is generated. The
user can then modify, save, or email the document as needed. This internal
Access capability has worked fine in 97, 2000, and 2003.
With Access 2007 the user can preview and print the report as they did in
the previous versions of Access. The publish button is available and
contains and looks to provide the same capabilities, the same selections are
available. The problem is that when the user actually says to Publish It to
MS Word, the program (Access 2007) blows up.
When you manually preview a report via the Access 2007 GUI, you can "Export"
the preview to different formats. In the case of Word, you are prompted for
a file name, and whether, or not, it should be opened by Word. This prompt
is not presented when the preview is instantiated in code as describe above.
Dim rpt As Report
gfPauseForPreview = True
'Declare and instantiate a copy of the report as defined in the "reports"
collection.
Set rpt = New Report_rpt_Areport
'Modify properties of the instantiated report.
rpt.Toolbar = "cstm_Print_Preview_Toolbar"
rpt.Caption = "Preview of: ArReport"
rpt.MenuBar = " "
rpt.MenuBar = "cstm_Print_Preview_Menu"
'Make the preview visible
rpt.VISIBLE = True
On Error GoTo AfterPause
Do While gfPauseForPreview
DoEvents
Loop
AfterPause:
Set rpt = Nothing
gfPauseForPreview is a public variable the is set to TRUE prior to the
report being made visible. After the report is made visible, a loop is
started to prevent the "rpt" object from going out of scope. When the user
is done with the preview, the "Close" event of the report changes the visible
property to false and sets the gfPauseForPreview to false, allowing the code
calling the preview to continue.
I need this functionality to be available in these applications. This is
used in several applications deployed within my agency. Having the ability
to publish to Word and then email reports save a lot of time.
I ran into a similar situation where Access 2007 was instantiating Word to
perform a mail merge. When done manually, a security prompt would be
presented. When done programmatically, the prompt would not be present and
the merge would not happen. This was addressed by MS KB 825765. Adding a
registry key turned the security prompt off. Is there a similar registry key
for the prompt present by Access 2007?
Any help would be greatly appreciated.
Thank you.