?
Solved

Removing dialog box when outputting to .snp report

Posted on 2007-08-08
9
Medium Priority
?
308 Views
Last Modified: 2013-11-28
Hi experts,

When I run the following line of code I get what looks like a dialog box that remains on screen until the report is produced.  The box contains information about the report being produced and moves through the report one page at a time showing the current page that it is on.  This dialog box looks very much like the dialog box that comes up when printing something.  I would like to remove this dialog box when producing this .snp report if possible but do not know how to do this.

DoCmd.OutputTo acReport, "R2", "SnapshotFormat(*.snp)", "c:\R2test.snp", False, ""

Many thanks,
Terry
0
Comment
Question by:TerenceHewett
  • 5
  • 4
9 Comments
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 19652364
Try DoCmd.SetWarnings FALSE
0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 19652366
and then after the DoCmd.Output

DoCmd.SetWarnings TRUE
0
 

Author Comment

by:TerenceHewett
ID: 19652539
Thank you for your posts.  I have already got the Docmd.SetWarnings FALSE and TRUE in my code but the print progress dialog box still appears.  Are there any other suggestions please?

Regards,
Terry
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Accepted Solution

by:
Barry Cunney earned 2000 total points
ID: 19652589
Put the following code in a new module:
Option Compare Database
Option Explicit

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long


Function DisablePrintDialog(DisableIt As Boolean)
On Error GoTo Err_Trap
    If DisableIt Then
        LockWindowUpdate (GetDesktopWindow)
    Else
        LockWindowUpdate (False)
    End If
    Exit Function

Err_Trap:
MsgBox Err.Number & ": " & Err.Description
Resume Next

End Function

Put the disable print code before and after your Output call as follows:


Private Sub cmdOuputReport_Click()
DisablePrintDialog (True)

    DoCmd.OutputTo acReport, "Sheet1", "SnapshotFormat(*.snp)", "c:\R2test.snp", False, ""

DisablePrintDialog (False)

End Sub

0
 

Author Comment

by:TerenceHewett
ID: 19652663
Thank you for your help.  I have put the code into a module and I have added the DisablePrintDialog code to my cmd button as you have in your example above, but when I compile, Access returns the following error and highlights "DisablePrintDialog(True)".

Expected Procedure or variable, not module

I am not sure what this means. Can you help?

Regards and thanks again.
Terry
0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 19652681
try the Call to Disable without brackets around TRUE and FALSE like below

DisablePrintDialog True

    DoCmd.OutputTo acReport, "Sheet1", "SnapshotFormat(*.snp)", "c:\R2test.snp", False, ""

DisablePrintDialog False
0
 

Author Comment

by:TerenceHewett
ID: 19652688
Access is highlighting "DiablePrintDialog" and not the "True" part.  The error message is still the same.

Terry
0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 19652689
What did you call the new module?
0
 

Author Comment

by:TerenceHewett
ID: 19708308
Thanks for your posts.  I had the module called the same as the code sub.  All fixed now.

Regards
Terry
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question