Link to home
Start Free TrialLog in
Avatar of Fritz Paul
Fritz PaulFlag for South Africa

asked on

Prevent printing of a report which is opened in preview mode

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
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fritz Paul

ASKER

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
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
User generated image
"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