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 / General 1 / December 2005

Tip: Looking for answers? Try searching our database.

navigate form with arrow keys

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gil - 29 Dec 2005 04:48 GMT
hello.
i would like to navigate my form with arrow keys by jumping to the next
control or previous control when ever i hit the up,down, left or right
key.
this works fine as long as i do not click on the field with my mouse or
do not type anything in the field. if i do either of those the key will
no longer jump to the next control, but rather be stuck on the current
control.
i know you can hit tab or enter as an alternative, but i would also
like to have the option to use arrow keys for navigation.
any ideas?
thanks
darkroomdevil - 29 Dec 2005 06:19 GMT
>hello.
>i would like to navigate my form with arrow keys by jumping to the next
[quoted text clipped - 8 lines]
>any ideas?
>thanks

Probably a number of ways to do this,  I use A'97, ran a test in the keydown
event to determine the keycode of each arrow ...

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
MsgBox Str(KeyCode)
End Sub

Then enter that code for each Select Case statement, I just tested for the
right arrow key and it worked fine even when editing a field.  I don't know
if it is necessary but I changed the KeyPreview property of the form to Yes
because it made sense ;)

Here it is for the right arrow key, add case statements for each of the other
arrow keys, Shift Tab will move backwards ...

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
   Case 39 'Right Arrow Key
       SendKeys "{TAB}"
End Select
End Sub

Hope this helps,
Roger
John Welch - 29 Dec 2005 07:35 GMT
try tools->options->keyboard->arrow key behavior->next field

> hello.
> i would like to navigate my form with arrow keys by jumping to the next
[quoted text clipped - 8 lines]
> any ideas?
> thanks
Steve - 29 Dec 2005 14:02 GMT
You can also use code to do this, but you would have to define custom
code for every control on every form you want this behavior to occur on.
darkroomdevil - 29 Dec 2005 16:37 GMT
Gil, I was thinking about this a little more and if I was your user and I
made an error in typing I would want the arrow keys to act normally rather
than grabbing the mouse to move the curser.  So, here is a suggestion that
might work for what you want without 'arrow edit confusion'  ... ;-)

Keep the right and left arrow the way they were, use the up arrow to get out
of edit mode (probably save record will do that) and the down arrow to enter
edit mode - to keep things consistent (Sendkeys "{END}" or "{HOME}" should do
that).  So up arrow then right arrow will move to next field when in edit
mode.

Roger
 
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



©2008 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.