Solved

Form_Keydown not allowed Tab Key

Posted on 2006-06-22
5
165 Views
Last Modified: 2010-04-07
I have a richtextbox and i need to use the tab key to move the text in the box and ive figured out it has something to do with this. How can i allow the tab key be passed through....

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode

    Case 112
        txtUDS.Locked = False
        lblStatus.Caption = "Writable"
    Case 115
        'Run Code
       
    Case 121
        Unload Me
    Case Else
        MsgBox KeyCode
End Select

End Sub

Private Sub Form_Load()
Me.KeyPreview = True
End Sub
0
Comment
Question by:thaburner
  • 3
  • 2
5 Comments
 
LVL 18

Accepted Solution

by:
Sethi earned 200 total points
Comment Utility
Private Sub richClinicalNotes_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyTab Then
        KeyCode = 0
        richClinicalNotes.SelText = vbTab
    End If
End Sub
0
 

Author Comment

by:thaburner
Comment Utility
hmmm didnt work
0
 
LVL 18

Expert Comment

by:Sethi
Comment Utility
You want the tab key to work in the richtextbox instead of navigating out? If yes then it has to work as I have been using this code for many years in my projects. Please change the name of the richtextbox in the code.
0
 

Author Comment

by:thaburner
Comment Utility
i got it working with your code provided i just had to turn the TabStop=False
Thx
0
 
LVL 18

Expert Comment

by:Sethi
Comment Utility
I am not sure why you had to turn TabStop=False as that is not required.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now