Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Avoid Tab

Posted on 2003-03-27
Medium Priority
Last Modified: 2010-05-01
Dear All,

I have two textboxes and one command button in a window. Textboxes are for to enter the login name & password. Command button I am using to allow the user to go into next screen if name & password is valid.
Is it possible to press "Enter" and move to next screen just after entering password? To avoid clicking the Command button.

Thnx & rgds

Question by:maan1970
  • 2
  • 2

Accepted Solution

Metalhead earned 80 total points
ID: 8219144
Yes in the KeyPress event of your textbox you can capture the keypressed and do whatever you want

Here's a sample code of what you might put in there, this checks if an Enter has been pressed and then executes your command button's Click event

    If KeyAscii = 13 Then
        KeyAscii = 0
    End If
LVL 44

Expert Comment

ID: 8219253
or, set the Default property of the Command Button to True.

One button can be set as the DEFAULT (Default=True), and when the Enter key is pressed, THAT button's click event is fired.


Expert Comment

ID: 8262915
I go with Arthur_Wood Using "Default=True" is the ultimate.

Also you can use "Cancel=True" for "Close" or "Cancel" Button if the user wanna close the window by pressing "Esc" Key.

Expert Comment

ID: 8262919
I go with Arthur_Wood Using "Default=True" is the ultimate.

Also you can use "Cancel=True" for "Close" or "Cancel" Button if the user wanna close the window by pressing "Esc" Key.


Expert Comment

ID: 8262988

  The Default=true is good if you want that button to be clicked on any Enter.
  But what I think he wants and probably is more logical, is if you are in the username textbox and press enter you go to the password textbox and then when you press enter you execute the OK button.


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

564 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