Solved

Make 'Enter' do tab action.

Posted on 1999-01-14
3
143 Views
Last Modified: 2010-05-03
Easy.  But I still can't figure out.  How to make enter key go through the tab order.
0
Comment
Question by:RUSTY
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:RUSTY
ID: 1456286
System won't let me edit question.  I'm using VB 5.0 Professional Edition.
0
 
LVL 3

Accepted Solution

by:
traygreen earned 20 total points
ID: 1456287
Set the KeyPreview to true on the form
On the key down event
   If KeyCode = 13 Then
      KeyCode = 0
      SendKeys "{TAB}"
   End If
0
 
LVL 3

Expert Comment

by:traygreen
ID: 1456288
I added this comment to the bottom of your reposted question.  It works better than monkeying around with the button as recomended by caraf_g

The beeb is due to windows determiniting that they key pressed in the control is invalid.  This is triggered prior to the key press event being fired
The problem with the default button is that it eliminates the key_down event on the form and fires the buttons clicked event.

The work around is to set the multiline property for the controls to true and then move the code to the key_press event...

Private Sub Form_KeyPress(KeyAscii As Integer)
   If KeyAscii = 13 Then
      KeyAscii = 0
      SendKeys "{TAB}"
   End If
End Sub

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

688 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