Disable Paste in Form Record Selector

M

Michael

I would like to disable or prevent pasting a whole record with a form Record
Selector. Can it be done?

The user can add a record in a new line. The Record Selector is used in that
form to select records to delete them or to do summation of records for a
certain field. So I do not want to disable the Record Selector. I just want
to prevent pasting through it, since I might cause errors in the form, or
pasting errors and then Access adding a “pasting errors†table…

Thanks in advance,

Michael
 
M

Michael

Seems that nobody had any suggestions.

Well, 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



Michael
 

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

Similar Threads


Top