Block Ctrl+P for Reports

G

Guest

I am trying to block Ctrl+P for a report when it is opened in view mode. Any
idea how to do this, there does not appear to be a keydown or keypress event
on which to determine the keys pressed. Ususally I can do something like


Public Sub mForm_KeyDown(KeyCode As Integer, Shift As Integer)
Dim bShiftDown As Integer, bAltDown As Integer, bCtrlDown As Integer
Dim intCtrl As Integer

bCtrlDown = (Shift And acCtrlMask) > 0 'Test for Ctrl key

If bCtrlDown And KeyCode = vbKeyP Then 'Ctrl+P pressed
KeyCode = 0 'throw out keystrokes
MsgBox ("Ctrl-P not allowed")
End If

.......
end sub

But I can't figure out how to do this with a report.

If this can't be done, is there anyway to block the print dialog via an API
call while the report is open in view mode, then allow it on report_close
event?

Thanks.
 
D

david epsom dot com dot au

You can block Ctrl-P by creating a key handler for that
key combination (look in help for 'autokeys'). However,
there does not seem to be any way to block [Alt-P], which
is the access-key combination for the P (print) menu item.

(david)
 
G

Guest

I've tried working with the autokeys but have not had any luck blocking the
ctrl-p when a report is in preview mode, any suggestions or examples?

Thanks,
Gordon

david epsom dot com dot au said:
You can block Ctrl-P by creating a key handler for that
key combination (look in help for 'autokeys'). However,
there does not seem to be any way to block [Alt-P], which
is the access-key combination for the P (print) menu item.

(david)

Gordon said:
I am trying to block Ctrl+P for a report when it is opened in view mode.
Any
idea how to do this, there does not appear to be a keydown or keypress
event
on which to determine the keys pressed. Ususally I can do something like


Public Sub mForm_KeyDown(KeyCode As Integer, Shift As Integer)
Dim bShiftDown As Integer, bAltDown As Integer, bCtrlDown As Integer
Dim intCtrl As Integer

bCtrlDown = (Shift And acCtrlMask) > 0 'Test for Ctrl key

If bCtrlDown And KeyCode = vbKeyP Then 'Ctrl+P pressed
KeyCode = 0 'throw out keystrokes
MsgBox ("Ctrl-P not allowed")
End If

......
end sub

But I can't figure out how to do this with a report.

If this can't be done, is there anyway to block the print dialog via an
API
call while the report is open in view mode, then allow it on report_close
event?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top