Solved

Prevent printing of a report which is opened in preview mode

Posted on 2014-03-13
4
700 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39927841
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
ID: 39928500
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39928969
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
ID: 39929042
"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

Technology Partners: 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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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