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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tab key in access

Status
Not open for further replies.

faxof

Programmer
Dec 5, 2001
272
GB
simple question:

is there any way of disabling the tab key when users open my dataase?
 
The simple question is that no, there isn't an easy way within VBA, but if necessary you could write form level keyboard handling code to map tab input to something else.

Something like this will do the trick (it neutralises all tab presses:

Private Sub Form_Keypress (KeyAscii As Integer)
If KeyAscii = vbKeyTab Then
KeyAscii = 0
End If
End Sub

Be sure if you use this to set the Form's Key Preview property to True, so it gets run before any control key related event handlers (it saves you having to code it for every control on the form).

I'm sure some of the people who work with lower level code will know API calls to stop it operating, or map it to something else.

John
 
Hi faxof,

If you don't mind, can I ask WHY you want to disable the Tab key? I accept (a bit grudgingly) that sometimes users have to be protected from themselves but what protection are you giving here? What can be done with the Tab key that cannot be done in another way, and are you not just removing flexibility and providing a maintenance headache?

I have seen many elaborate attempts to restrict inbuilt functionality and they rarely, if ever, add to an application.

I hope I haven't offended by asking this but I guess its one of my pet hates.

Enjoy,
Tony
 
Tony,

Good point - the only time I can remember is when an experienced user of a DOS app was migrating to Windows and pressing ENTER kept triggering the default button rather than moving to the next field - it took a while to get them retrained but they did in the end.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top