Solved

Prevent printing of a report which is opened in preview mode

Posted on 2014-03-13
4
719 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
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 …

705 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