Close a report in Preview Mode with disabled menus & disabled right Click (1 Viewer)

HillTJ

Registered User.
Local time
Today, 01:30
Joined
Apr 1, 2019
Messages
502
Hi,

It's probably simple, but how do I close a report that is in preview mode after I've disabled both the right click menu & the toolbar ribbon?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:30
Joined
Oct 29, 2018
Messages
16,599
Are you talking about using a keyboard shortcut or an Autokeys macro?
 

HillTJ

Registered User.
Local time
Today, 01:30
Joined
Apr 1, 2019
Messages
502
@theDBguy , so I use a subroutine that populates :DoCmd.OpenReport [strReportName], acViewPreview, , strWhere. But once I've hidden the toolbar ribbon & disabled the right click option, I cannot figure how to close the form. I'd like the user to be able to click a 'Close" button to close the report. What am I missing? Appreciate the prompt response.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:30
Joined
May 7, 2009
Messages
14,156
add a Shortcut Menu bar to your report.
see the 2 macros in design view.
see the report in design view, see the Shortcut Menu bar (property).
view in print preview and right-click.
 

Attachments

  • reportMenu.accdb
    564 KB · Views: 25

HillTJ

Registered User.
Local time
Today, 01:30
Joined
Apr 1, 2019
Messages
502
@arnelgp , well that works. I'll give it a go on my report. I remember sometime I read about putting a command button on a report that was not printed along with the body. I couldn't find it, nor am I sure whether this would work in 'preview' mode. But, your solution works. Can i display a 'permanent button? Appreciate it.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:30
Joined
Oct 29, 2018
Messages
16,599
@theDBguy , so I use a subroutine that populates :DoCmd.OpenReport [strReportName], acViewPreview, , strWhere. But once I've hidden the toolbar ribbon & disabled the right click option, I cannot figure how to close the form. I'd like the user to be able to click a 'Close" button to close the report. What am I missing? Appreciate the prompt response.
Buttons in Preview mode won't work, but they will in Report view. What I've done before, as well, was use a popup form as a floating button to close the report in Preview mode.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:30
Joined
May 7, 2009
Messages
14,156
you need to initially view your report on "report" view if you are going to put a "print button".
Code:
Private Sub printButton_Click()
'set focus to another textbox
Me.ID.SetFocus
Me.printButton.Visible = False
DoCmd.PrintOut
Me.printButton.Visible = True
End Sub
 

HillTJ

Registered User.
Local time
Today, 01:30
Joined
Apr 1, 2019
Messages
502
Gents, thanks. Will trial the options suggested & let you know. Thanks for the prompt response. I really appreciate it.
 

isladogs

CID VIP
Local time
Today, 13:30
Joined
Jan 14, 2017
Messages
15,412
Alternatively, you can reinstate the ribbon when the report is opened and remove it again when the report is closed.
The attached example shows several ways of handling reports in an application with no ribbon (or in this case, no application window either).
For more info, see Control Application Interface - Mendip Data Systems

EDIT: I have now replaced the zip file as the original caused problems for the OP
 

Attachments

  • SetWindows - v3.49.zip
    318.8 KB · Views: 18
Last edited:

HillTJ

Registered User.
Local time
Today, 01:30
Joined
Apr 1, 2019
Messages
502
Colin, thanks. But upon unzipping the main menu covers the windows ...accept macros... button & I cannot click to accept! I cannot move the main menu to uncover. Any ideas.
 

isladogs

CID VIP
Local time
Today, 13:30
Joined
Jan 14, 2017
Messages
15,412
Sorry about that.
The usual solution to this type of problem is to open the file using the shift bypass.
Or you could open the file from a trusted location.

However, I've replaced the zip file in post #9 and it should now be OK. Please let me know
 

HillTJ

Registered User.
Local time
Today, 01:30
Joined
Apr 1, 2019
Messages
502
@isladogs, cheers thanks. By the way, i'm using your login code, which works a treat!..
 

HillTJ

Registered User.
Local time
Today, 01:30
Joined
Apr 1, 2019
Messages
502
@isladogs , I had a play with your Demo today & can certainly adapt some of your code. Appreciate the effort you have clearly gone to to generate this demo. Will let you know what concept(s) I use. Cheers.
 

isladogs

CID VIP
Local time
Today, 13:30
Joined
Jan 14, 2017
Messages
15,412
You're welcome. I've been gradually adding to that demo app over several years.
I've made quite a few changes recently. Here is the latest version (3.55)
 

Attachments

  • SetWindows - v3.55.zip
    447.3 KB · Views: 8

Users who are viewing this thread

Top Bottom