Solved How to go to the same field, next record in a continuous form?

Sun_Force

Active member
Local time
Tomorrow, 07:36
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.
 
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?
 
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
 
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.
 
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.
 
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
 
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

Back
Top Bottom