Solved

Prevent printing of a report which is opened in preview mode

Posted on 2014-03-13
4
643 Views
Last Modified: 2014-03-14
Access 2010.

I have a report, which I wish to preview, but I want to prevent it from being printed.

Presently the report is opened in preview mode by a form embedded macro.

I am quite happy to use VBA instead if you can help me in that way.

Thanks
0
Comment
Question by:Fritz Paul
  • 2
  • 2
4 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
open the form in design view

from the ribbon
Form Design Tools > design
     locate on the farther right side of the ribbon
       
     * convert forms macro to visual basic

copy the converted VBA codes and post here..

or you can try this in the Open event of the report

docmd.showtoolbar "ribbon", actoolbarno
0
 

Author Comment

by:Fritz Paul
Comment Utility
Although
docmd.showtoolbar "ribbon", actoolbarno
works, I can still right click and then select "print" and it prints.

Can I prevent the right click function also?

What I actually need is to prevent any print action while the report is open in preview mode.

In case you still need the code, I paste it below.

(Explanation of why: My form has a print control and a preview control. When I hit "print" the first time, the report is printed and marked as printed. Thereafter it should not be printed again, but through preview, I still want it to open just for viewing. I realise I will still be able to Print Screen, but that will give me a obiously invalid document.)

    DoCmd.RunCommand acCmdRefresh
    If (IsNull(RegNo)) Then
        MsgBox "Registration Number is still outstanding.", vbCritical, "Registration Number outstanding."
        DoCmd.CancelEvent
        Exit Sub
    End If
    If (IsNull(Invoice_No)) Then
        MsgBox "Invoice Number is still outstanding", vbCritical, "Invoice Number outstanding."
        DoCmd.CancelEvent
        Exit Sub
    End If
    If (CertPrinted = True) Then
        Beep
        MsgBox "This Certificate has already been printed", vbOKOnly, "Certificate already printed"
    End If
    DoCmd.OpenReport "rptManufacturingCert", acViewPreview, "", "", acNormal
   


cmdViewManuf_Click_Exit:
    Exit Sub

cmdViewManuf_Click_Err:
    MsgBox Error$
    Resume cmdViewManuf_Click_Exit
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
Although
docmd.showtoolbar "ribbon", actoolbarno
works, I can still right click and then select "print" and it prints.

use the following setting
Office button > access options > current database

uncheck the following
x
0
 

Author Closing Comment

by:Fritz Paul
Comment Utility
"docmd.showtoolbar "ribbon", actoolbarno" in fact answered my initial question. It was only afterwards than I noticed that I could still right click and select print from the shortcut popup.
So I am left with another question, which I will put seperately. I do need to do the control with VBA, because I do not want users to be able to reset the function.
I have managed to switch the function off by the code below, but I do not get it on afterwards.

    For i = 1 To CommandBars.Count 'http://forums.aspfree.com/microsoft-access-help-18/disable-all-menu-bars-except-right-click-mouse-111386.html
        CommandBars(i).Enabled = False
        CommandBars("Property Sheet").Enabled = True 'If I do add this, the "Property Sheet" is gone.
    Next i

Thanks a lot.

fripau
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now