When I run MS Access form, if I press shortcut keys like control a, control c, control v, control d or control f, then the data of main data table gets messed up.
Is there any way to prevent the user from using these shortcut keys?
Thank you.
When I run MS Access form, if I press shortcut keys like control a, control c, control v, control d or control f, then the data of main data table gets messed up.
Is there any way to prevent the user from using these shortcut keys?
Thank you.
See similar threads at the bottom of this one
I have Google on this laptop.
https://www.google.com/search?q=prev...hrome&ie=UTF-8
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
this is a common question and thought a couple of them used methods so you can detect the key, but it would appear not
So I just googled your question and found numerous links
https://duckduckgo.com/?q=access+vba...t=opera&ia=web
the first one looks like it does what you require
https://stackoverflow.com/questions/...an-access-form
See also my article Prevent Copy & Paste (isladogs.co.uk) and video https://youtu.be/Y2MHYbuWmYU
Thank you very much to all of you for solving the problem, if teachers like you are not on this platform, then who knows what would have happened to beginners like us.
Thank you
i used this code
Code:Private Sub Form_Open(Cancel As Integer) Me.KeyPreview = True End Sub Private Sub Form_KeyDown(keycode As Integer, shift As Integer) sb_disablekeys keycode, shift End Sub Public Sub sb_disablekeys(keycode As Integer, shift As Integer) 'All keyboard events with CTRL don’t function anymore with the exception of CTRL+C and CTRL+V ' ‘All keyboard events with ALT don’t function anymorge ' ‘All function keys are disabled Select Case shift Case acCtrlMask ' ‘CTRL pressed Select Case keycode Case 0 To 16, 18 To 66, 68 To 85, 87 To 255 'All keycodes with the exception of 17 (CTRL), 67 (CTRL+C) and 86 (CTRL+V) are set to 0. keycode = 0 End Select Case acAltMask 'Alt pressed keycode = 0 End Select Select Case keycode Case vbKeyF1 To vbKeyF16 ' ‘Function key pressed keycode = 0 End Select End Sub