Solved

Make 'Enter' do tab action.

Posted on 1999-01-14
3
139 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
  • 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

770 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