Solved How to go to the same field, next record in a continuous form? (1 Viewer)

Sun_Force

Active member
Local time
Tomorrow, 01:25
Joined
Aug 29, 2020
Messages
396
Pressing up/down Arrow keys in tables take me to the same field of the next/previous record.
How can I have the same functionality in continuous forms?

I couldn't follow the instructions in following post because of the change in UI.



Thank you.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:25
Joined
Oct 29, 2018
Messages
21,467
Hi. I didn't read the linked thread you posted, but in a continuous form, you would need to use VBA code to do something like that? Have you considered using Datasheet View instead?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:25
Joined
May 7, 2009
Messages
19,230
add code to the Form's Keydown event.
make sure that the Form's "Key Preview" event is set to Yes.
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    'arnelgp
    On Error Resume Next
    With Me.Recordset
        If KeyCode = 40 Then     'down arrow
            If Me.CurrentRecord = .RecordCount Then
                .AddNew
            Else
                .MoveNext
            End If
            
        Else
        
            If KeyCode = 38 Then    'up arrow
                .MovePrevious
                
            End If
            
        End If
        
    End With
End Sub
 

Sun_Force

Active member
Local time
Tomorrow, 01:25
Joined
Aug 29, 2020
Messages
396
Hi. I didn't read the linked thread you posted, but in a continuous form, you would need to use VBA code to do something like that? Have you considered using Datasheet View instead?

Thanks for your reply. I've been asked to use a continuous form.
 

Sun_Force

Active member
Local time
Tomorrow, 01:25
Joined
Aug 29, 2020
Messages
396
add code to the Form's Keydown event.
make sure that the Form's "Key Preview" event is set to Yes.
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    'arnelgp
    On Error Resume Next
    With Me.Recordset
        If KeyCode = 40 Then     'down arrow
            If Me.CurrentRecord = .RecordCount Then
                .AddNew
            Else
                .MoveNext
            End If
            
        Else
        
            If KeyCode = 38 Then    'up arrow
                .MovePrevious
                
            End If
            
        End If
        
    End With
End Sub

Thanks for your time and the code. I hoped there may be a setting somewhere. While your code works but I hate using keydown event. I simply don't like run a function every time I press a key. I think that's why Key Preview property is set to No by default.

Thanks again for your help.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:25
Joined
Feb 19, 2002
Messages
43,257
this Arrow key behavior is something that MS likes to change from version to version, probably just to see if we're paying attention. In my version, the up/down arrows work the way you want them to.
AccessVer20210124.JPG
 

CJ_London

Super Moderator
Staff member
Local time
Today, 17:25
Joined
Feb 19, 2013
Messages
16,607
I couldn't follow the instructions in following post because of the change in UI.
in later versions of access go to file>options>client settings. In the editing section you will find 'move after enter'
 

Users who are viewing this thread

Top Bottom