Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disable/enable Insert key?

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
Would someone please show me the vba code for enabling/disabling the insert key and the Caps key.

Thank you!

Steve
I use Access 2000
 
place this in the Key Down property of the control or form

Select Case KeyCode
' If user presses insert or shift
Case 45, 16
' Disable the keystroke by setting it to 0
KeyCode = 0
Case Else
Debug.Print KeyCode, Shift
End Select

to find the code for any key press create a web page and place it on your desk top and paste the following code in the html page when you press a key it will display the value

<HTML>
<HEAD>
<TITLE>keyCode</TITLE>
</HEAD>
<BODY onkeydown=&quot;displaykey();&quot;>
<INPUT TYPE=&quot;text&quot; name=&quot;text1&quot;>
</BODY>
<SCRIPT>
function displaykey() {
text1.value=event.keyCode+' : '+String.fromCharCode(event.keyCode);
}
</SCRIPT>
</HTML>
 
Thank you so much for this help! What if I want to disable the insert key and have it instead call an event while in this form only.

Steve
 
Good explanation, jioek.

Steve728,
You're not exactly &quot;disabling the key,&quot; you're just capturing the keystroke in this form only, and canceling (or changing) it's normal action.
Case 45
' Disable the usual action by setting it to 0
KeyCode = 0
'code to call the fancy sub routine with the new action
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top