Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / August 2007

Tip: Looking for answers? Try searching our database.

Execute command in field when enter key is pressed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mmatzke@comcast.net - 06 Jun 2007 21:26 GMT
How can I get a command to execute when the enter key is pressed after
entering data?

Signature

Mark Matzke

Carl Rapson - 06 Jun 2007 22:48 GMT
> How can I get a command to execute when the enter key is pressed after
> entering data?

Handle the KeyDown event for the control, and check to see if the key
pressed was the Enter key:

If KeyCode = vbKeyReturn Then
   ' Execute your command here
End If

One note: the KeyDown event won't fire if you have a command button on your
form which has its Default property set to Yes. In that case, you may need
to use the KeyPress event instead.

Carl Rapson
DawnTreader - 31 Aug 2007 22:44 GMT
that was exactly what i was looking for. thanks.

i had to adapt one thing

If KeyAcsii = vbKeyReturn Then
    ' Execute your command here
End If

where does the KeyCode come into play? is it depending on the event that you
use it in? or is it just the variable you assign in the

Private Sub myField_KeyPress(KeyAscii As Integer)

thingy?

> > How can I get a command to execute when the enter key is pressed after
> > entering data?
[quoted text clipped - 11 lines]
>
> Carl Rapson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.