?
Solved

Prevent printing of a report which is opened in preview mode

Posted on 2014-03-13
4
Medium Priority
?
741 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 1500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

752 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