UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Ctrl + P, Access 2016    
 
   
SallyCh
post Jun 7 2019, 03:50 AM
Post#1



Posts: 66
Joined: 24-October 14
From: UK


Hi

I need a Print button on a report that takes you to the Print Options window (Ctrl + P). I also need to disable Ctrl + P, as printing is restricted and the user needs a password to print.

I tried SendKeys "^P" but his doesn't work

I thought this would be fairly simple coding but I've researched it and cannot find anything useful.

Thanks
Go to the top of the page
 
June7
post Jun 7 2019, 04:16 AM
Post#2



Posts: 602
Joined: 25-January 16



I disable Ctl+P with an AutoKeys macro. This macro intercepts the Ctl+P keystrokes and prevents action. User gets a popup message Ctrl+P not available.

Cannot have a clickable button on report in PrintPreview. User would have to click Print on ribbon.

So have a button on form that sends report to printer.

This post has been edited by June7: Jun 7 2019, 04:18 AM

--------------------
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG! http://www.cpearson.com/Excel/DebuggingVBA.aspx
Go to the top of the page
 
theDBguy
post Jun 7 2019, 07:15 AM
Post#3


Access Wiki and Forums Moderator
Posts: 75,531
Joined: 19-June 07
From: SunnySandyEggo


I guess you could have the autokeys macro ask for a password.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
SallyCh
post Jun 10 2019, 05:31 AM
Post#4



Posts: 66
Joined: 24-October 14
From: UK


Hi all,

Thanks for the pointers.

I realise you can't put a Print Button on the PrintPreview of the Report. I wanted one on the ReportView, displayed on ScreenOnly. Using the print button on the Print Preview ribbon is not possible, as this database has sensitive/restricted data and can only be printed/accessed with strict controls, so I have all the ribbons unavailable.

A simple Print Button/command wouldn't work, as the Administrator needs the option of where to print, whether that be to one of the many printers in the office or to PDF.

A password on an AutoKey Macro could be the answer. Could someone guide me to setting this up?

Thanks.

Go to the top of the page
 
SallyCh
post Jun 10 2019, 06:33 AM
Post#5



Posts: 66
Joined: 24-October 14
From: UK


Hi all

I found the link below, which I've used to disable the Ctrl P, but I also need something to disable the PrintScreen keystroke.

As I've named the first Macro Autokeys, I can't do another one for PrintScreen with the same name.

Could I use a command button on the ReportView to trigger Ctrl P, using a macro?

I've only ever used VBA so macros are a bit new to me.

https://stackoverflow.com/questions/3809343...n-pane/39984283
Go to the top of the page
 
theDBguy
post Jun 10 2019, 07:09 AM
Post#6


Access Wiki and Forums Moderator
Posts: 75,531
Joined: 19-June 07
From: SunnySandyEggo


Hi. Look up the RunCommand action. I think it’s available in a macro.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
SallyCh
post Jun 10 2019, 07:13 AM
Post#7



Posts: 66
Joined: 24-October 14
From: UK


Hi again

I'm managing to work through my issues.

I now can disable Ctrl P with:

Private Sub Report_KeyDown(KeyCode As Integer, shift As Integer)
If shift = 2 Then
Select Case KeyCode
Case 80
MsgBox "Print Unavailable", vbInformation, "Formulation Report"

KeyCode = 0
End Select
End If
End Sub

and I can have a button on the ReportView which opens the PrintObject Window

Private Sub cmdPrint_Click()

DoCmd.RunCommand acCmdPrint

End Sub

I just need to work out how to disable the Print Screen, using the similar VBA as above.
Go to the top of the page
 
June7
post Jun 10 2019, 12:49 PM
Post#8



Posts: 602
Joined: 25-January 16



So you disable Ctl+P only for the report?

Not sure what you mean by 'Print Screen'.

I also have customized ribbons and shortcuts. So I have a custom ribbon that activates only for reports. This provides the print button for reports in PrintPreview, reports are not opened in ReportView.

--------------------
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG! http://www.cpearson.com/Excel/DebuggingVBA.aspx
Go to the top of the page
 
SallyCh
post Jun 12 2019, 06:35 AM
Post#9



Posts: 66
Joined: 24-October 14
From: UK


Hi June 7,

I only need to have these restrictions on 1 form and 1 report.

When I refer to Print Screen, I mean the PrtScn button on the keyboard. I don't want the users to get around printing the report by copying and pasting the screen. I now realise that I can't just disable (Ctrl+Alt+Prtscn) because (Windows Button+Prtscrn) also enables the user to copy & paste.

I need to recognise when the Prtscn button is pressed, regardless of what other keys are also used.


I've changed the keydown coding to:

If acCtrlMask And KeyCode = 80 Then
MsgBox ("Print is unavailable")
KeyCode = 0
End If


If KeyCode = 44 Then

MsgBox ("Print Screen is unavailable")
KeyCode = 0
End If

The first part still works, but I don't know the correct coding for the print screen button.

I've always hidden all ribbons, and used custom buttons. I may revisit this idea. If I allow Print Preview, but with a custom ribbon, how can I password protect printing?


Go to the top of the page
 
June7
post Jun 12 2019, 02:41 PM
Post#10



Posts: 602
Joined: 25-January 16



I don't password protect anything.

But maybe build your own Print button on the custom ribbon that calls VBA procedure.


This post has been edited by June7: Jun 12 2019, 02:43 PM

--------------------
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG! http://www.cpearson.com/Excel/DebuggingVBA.aspx
Go to the top of the page
 
theDBguy
post Jun 12 2019, 03:23 PM
Post#11


Access Wiki and Forums Moderator
Posts: 75,531
Joined: 19-June 07
From: SunnySandyEggo


QUOTE
The first part still works, but I don't know the correct coding for the print screen button.
Hi. Unfortunately, if you look here, you'll notice there is no available KeyCode for that button on the keyboard. Sorry.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    19th June 2019 - 10:47 AM