dbTalk Databases Forums  

Prevent report from printing

comp.databases.ms-access comp.databases.ms-access


Discuss Prevent report from printing in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Phil
 
Posts: n/a

Default Prevent report from printing - 10-17-2011 , 11:27 AM






I have a form with a button on it that basically previews an invoice (Report)
based on the form. If I try to print the report I get an error message which
almost certainly is wrong. It says “A custom macro in this report has failed
to run” I believe this actaully is the equally missnamed error "Too many
databases open" which means too many tables or queries open as I understand
it.

The Code is DoCmd.OpenReport "RptPaymentRecord", acViewPreview, ,
"MemHeadOfHouseID = " & MemHeadOfHouseID

Anyway, I'm rambling.
I have a second button that Closes the Preview report and then runs
DoCmd.OpenReport "RptPaymentRecord", acViewNormal, ,"MemHeadOfHouseID = " &
MemHeadOfHouseID This runs OK

What I want to do is stop anyone using any of the print methods from the
Preview report such as ^P or right clicking the report.

Any thoughts?

Phil

Reply With Quote
  #2  
Old   
Patrick Finucane
 
Posts: n/a

Default Re: Prevent report from printing - 10-18-2011 , 09:55 AM






On Oct 17, 11:27*am, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
Quote:
I have a form with a button on it that basically previews an invoice (Report)
based on the form. If I try to print the report I get an error message which
almost certainly is wrong. It says “A custom macro in this report has failed
to run” I believe this actaully is the equally missnamed error "Too many
databases open" which means too many tables or queries open as I understand
it.

The Code is DoCmd.OpenReport "RptPaymentRecord", acViewPreview, ,
"MemHeadOfHouseID = " & MemHeadOfHouseID

Anyway, I'm rambling.
I have a second button that Closes the Preview report and then runs
DoCmd.OpenReport "RptPaymentRecord", acViewNormal, ,"MemHeadOfHouseID =" &
MemHeadOfHouseID This runs OK

What I want to do is stop anyone using any of the print methods from the
Preview report such as ^P or right clicking the report.

Any thoughts?

Phil
Regarding the CTRL+P, can qn OnKey-type event trap it? Would creating
a custom menu be of any use?

Reply With Quote
  #3  
Old   
Phil
 
Posts: n/a

Default Re: Prevent report from printing - 10-19-2011 , 03:43 AM



On 18/10/2011 15:55:17, Patrick Finucane wrote:
Quote:
On Oct 17, 11:27*am, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
I have a form with a button on it that basically previews an invoice (Rep
ort)
based on the form. If I try to print the report I get an error message wh
ich
almost certainly is wrong. It says “A custom macro in this report has f
ailed
to run” I believe this actaully is the equally missnamed error "Too man
y
databases open" which means too many tables or queries open as I understa
nd
it.

The Code is DoCmd.OpenReport "RptPaymentRecord", acViewPreview, ,
"MemHeadOfHouseID = " & MemHeadOfHouseID

Anyway, I'm rambling.
I have a second button that Closes the Preview report and then runs
DoCmd.OpenReport "RptPaymentRecord", acViewNormal, ,"MemHeadOfHouseID " &
MemHeadOfHouseID This runs OK

What I want to do is stop anyone using any of the print methods from the
Preview report such as ^P or right clicking the report.

Any thoughts?

Phil

Regarding the CTRL+P, can qn OnKey-type event trap it? Would creating
a custom menu be of any use?

Thanks, Patrick

Private Sub Report_KeyDown(KeyCode As Integer, Shift As Integer)

Dim intCtrlDown As Integer

' Use bit masks to determine which key was pressed.
intCtrlDown = (Shift And acCtrlMask) > 0

' Display message telling user which key was pressed.
If intCtrlDown Then
MsgBox "Sorry, you can't print from this preview, " & vbCrLf _
& "use the print button on the Payment record form.", vbInformation
End If

End Sub

Works a treat, brilliant

Phil

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.