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

HillTJ

To train a dog, first know more than the dog..
Local time
Today, 10:47
Joined
Apr 1, 2019
Messages
712
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, 14:47
Joined
Oct 29, 2018
Messages
21,358
Are you talking about using a keyboard shortcut or an Autokeys macro?
 

HillTJ

To train a dog, first know more than the dog..
Local time
Today, 10:47
Joined
Apr 1, 2019
Messages
712
@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
Tomorrow, 05:47
Joined
May 7, 2009
Messages
19,169
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: 249

HillTJ

To train a dog, first know more than the dog..
Local time
Today, 10:47
Joined
Apr 1, 2019
Messages
712
@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, 14:47
Joined
Oct 29, 2018
Messages
21,358
@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
Tomorrow, 05:47
Joined
May 7, 2009
Messages
19,169
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

To train a dog, first know more than the dog..
Local time
Today, 10:47
Joined
Apr 1, 2019
Messages
712
Gents, thanks. Will trial the options suggested & let you know. Thanks for the prompt response. I really appreciate it.
 

isladogs

MVP / VIP
Local time
Today, 21:47
Joined
Jan 14, 2017
Messages
18,186
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: 230
Last edited:

HillTJ

To train a dog, first know more than the dog..
Local time
Today, 10:47
Joined
Apr 1, 2019
Messages
712
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

MVP / VIP
Local time
Today, 21:47
Joined
Jan 14, 2017
Messages
18,186
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

To train a dog, first know more than the dog..
Local time
Today, 10:47
Joined
Apr 1, 2019
Messages
712
@isladogs, cheers thanks. By the way, i'm using your login code, which works a treat!..
 

HillTJ

To train a dog, first know more than the dog..
Local time
Today, 10:47
Joined
Apr 1, 2019
Messages
712
@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

MVP / VIP
Local time
Today, 21:47
Joined
Jan 14, 2017
Messages
18,186
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: 227

Users who are viewing this thread

Top Bottom