[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Disable and Enable vbTABKEY in Access

I am trying to control the use of the TAB key in my form.  I am able to disable using:

Select Case KeyCode
        Case vbKeyTab
            KeyCode = 0
    End Select

but do not know how to enable it again.  Any idea what I set the value at?  I tried 1 and -1 but it didn't work

Thanks
0
marku24
Asked:
marku24
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You're disabling it via code ... the only way to enable it is to comment out that code:

Select Case KeyCode
        Case vbKeyTab
           ' KeyCode = 0
    End Select

Note the ' I placed in from of "KeyCode = 0". This marks the line as a comment, and VBA won't run it.

If you need to selectively disable it, you'd have to include some sort of interface item the code can reference. For example, you could include a Check box named "chkDisableTab", and then do this:

If chkDisableTab Then
  Select Case KeyCode
        Case vbKeyTab
            KeyCode = 0
   End Select
End If

Open in new window


This way, the code will only run if ckDisableTab = True.
0
 
marku24Author Commented:
exactly what i needed.  thank you
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now