A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Tabular Form - Move Cursor Down



 
 
Thread Tools Display Modes
  #1  
Old April 21st, 2010, 03:41 AM posted to microsoft.public.access.forms
Zee
external usenet poster
 
Posts: 33
Default Tabular Form - Move Cursor Down

I've created a tabular form in Access 2007. I would like the cursor to move
down the column I'm currently in when I either click on the enter key or down
arrow; similiar to what you can do in datasheet form.

Is there a way to do this?
  #2  
Old April 21st, 2010, 04:37 AM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Tabular Form - Move Cursor Down

On Tue, 20 Apr 2010 19:41:01 -0700, Zee
wrote:

That's pretty straightforward. I created a ContinuousForm based on the
Customers table in the Northwind sample app, and added the following:

Private Sub ID_KeyDown(KeyCode As Integer, Shift As Integer)
HandleKeyDown Me.ID, KeyCode, Shift
End Sub

Private Sub Company_KeyDown(KeyCode As Integer, Shift As Integer)
HandleKeyDown Me.Company, KeyCode, Shift
End Sub

Private Sub HandleKeyDown(ctl As Control, KeyCode As Integer, Shift As
Integer)
If KeyCode = vbKeyUp And Shift = 0 Then
RunCommand acCmdRecordsGoToPrevious
ctl.SetFocus
ElseIf KeyCode = vbKeyDown And Shift = 0 Then
RunCommand acCmdRecordsGoToNext
ctl.SetFocus
End If
End Sub

So for the ID and Company controls I'm handling KeyDown event and
calling my private HandleKeyDown procedure. In it, I am testing for
the KeyUp and KeyDown keycodes signifying CursorUp and CursorDown, and
I am checking that no shift, control, or alt key was down at the same
time. Then I simply move to the previous or next record, and set focus
to my control.
I leave up to you to handle possible errors trying to move up from the
first row or down from the last row.

-Tom.
Microsoft Access MVP


I've created a tabular form in Access 2007. I would like the cursor to move
down the column I'm currently in when I either click on the enter key or down
arrow; similiar to what you can do in datasheet form.

Is there a way to do this?

  #3  
Old April 21st, 2010, 04:37 PM posted to microsoft.public.access.forms
Zee
external usenet poster
 
Posts: 33
Default Tabular Form - Move Cursor Down

Tom,
Thank you so much for your help.

"Tom van Stiphout" wrote:

On Tue, 20 Apr 2010 19:41:01 -0700, Zee
wrote:

That's pretty straightforward. I created a ContinuousForm based on the
Customers table in the Northwind sample app, and added the following:

Private Sub ID_KeyDown(KeyCode As Integer, Shift As Integer)
HandleKeyDown Me.ID, KeyCode, Shift
End Sub

Private Sub Company_KeyDown(KeyCode As Integer, Shift As Integer)
HandleKeyDown Me.Company, KeyCode, Shift
End Sub

Private Sub HandleKeyDown(ctl As Control, KeyCode As Integer, Shift As
Integer)
If KeyCode = vbKeyUp And Shift = 0 Then
RunCommand acCmdRecordsGoToPrevious
ctl.SetFocus
ElseIf KeyCode = vbKeyDown And Shift = 0 Then
RunCommand acCmdRecordsGoToNext
ctl.SetFocus
End If
End Sub

So for the ID and Company controls I'm handling KeyDown event and
calling my private HandleKeyDown procedure. In it, I am testing for
the KeyUp and KeyDown keycodes signifying CursorUp and CursorDown, and
I am checking that no shift, control, or alt key was down at the same
time. Then I simply move to the previous or next record, and set focus
to my control.
I leave up to you to handle possible errors trying to move up from the
first row or down from the last row.

-Tom.
Microsoft Access MVP


I've created a tabular form in Access 2007. I would like the cursor to move
down the column I'm currently in when I either click on the enter key or down
arrow; similiar to what you can do in datasheet form.

Is there a way to do this?

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:04 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.