?
Solved

key presses

Posted on 2003-02-28
2
Medium Priority
?
218 Views
Last Modified: 2010-05-01
get VB to responed to a press of the enter key
0
Comment
Question by:col_jack_oneal
[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 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 8042893
make sure to set your form's keypreview property to true and then:

Private Sub Form_KeyPress(keyascii As Integer)
   if keyascii = 13 then
     msgbox "enter pressed"
  end if
End Sub
0
 
LVL 2

Expert Comment

by:Sweat
ID: 8042902
col jack,

The KeyPress event can identify the ENTER key and you can then do what you want with it.

Private Sub Text1_KeyPress(KeyAscii As Integer)

     If KeyAscii = 13 Then
        KeyAscii=0
        ' Your code here
        Exit Sub
     End If

Hope this helps,

Sweat

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
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 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…
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 Month14 days, 1 hour left to enroll

800 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