I need the Record Selector to be able to delete records and to select records
for calculation.
But I want to Prevent or disable copy/paste from Record Selector.
So I thought to detect if the Record Selector had the focus so then the
Clipboard would be emptied.
But you got me thingking, I saw the path I was taking was wrong. I found the
answer to preventing Paste form Record Selector : Detecting Ctrl-V key stroke
and preventing ShortcutMenu in the Record Selector.
Here is my code if it might interest somebody, or if somebody might suggest
better way:
'Detect ctrl-V combination and disable Paste
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = acCtrlMask And KeyCode = vbKeyV Then
MsgBox "Ctrl-V Error Message" 'If there is no MsgBox then Paste will
take effect!
End If
End Sub
'Bellow: Prevent ShortcutMenu in Record Selector and enable ShortcutMenu
elsewhere
Private Sub Form_Open(Cancel As Integer)
Enable_ShorcutMenu_In_Controls
End Sub
Private Sub Enable_ShorcutMenu_In_Controls()
Dim ctl As Control
If Me.ShortcutMenu = False Then
For Each ctl In Me.Controls
ctl.OnMouseDown = "=ShortcutMenu_True()"
Next
End If
End Sub
Private Function ShortcutMenu_True()
Me.ShortcutMenu = True
End Function
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single,
Y As Single)
If X <= 255 Then
'MsgBox "No Right-Click"
Me.ShortcutMenu = False
Else
Me.ShortcutMenu = True
End If
End Sub
Private Sub FormHeader_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Me.ShortcutMenu = True
End Sub
Private Sub Detail_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Me.ShortcutMenu = True
End Sub
Private Sub FormFooter_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Me.ShortcutMenu = True
End Sub
Thanks
Michael