Solved

Make 'Enter' do tab action.

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

685 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