Solved

Make 'Enter' do tab action.

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Updates not working for MS Windows 7 12 181
Child Form in front 4 49
MS SQL Update query with connected table data 3 34
Collapse and expand table in Word 2010 2 29
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

791 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