> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# AddNew Increments AutoNumber Fields
- URL: https://nolongerset.com/addnew-increments-autonumber-fields/
- Published: 2021-05-12T03:26:29.000Z
- Updated: 2026-05-08T13:04:45.000Z
- Description: Thanks to Ben Clothier, we've got another improvement to our Arrow Key Navigation class.
- Author: Mike Wolfe
- Tags: Events, #Import 2026-05-20 02:59

In my [previous article](https://nolongerset.com/many-objects-one-class-module/) on overriding [Access's default arrow key behavior](https://nolongerset.com/navigating-continuous-forms/) on continuous forms, I wrote that there were still a couple final details to work out, including avoiding unnecessary incrementing of the autonumber ID.

What is this problem exactly? Honestly, it was a problem I didn't even realize I had until Access MVP [Ben Clothier](https://accessexperts.com/the-team-access-expert-developer/) of [IT Impact](https://accessexperts.com/access-developer-blog/) wrote in to alert me to it. As it turns out, Ben had just barely beaten me to the punch (by about eight years) with his own article about using WithEvents to override Access's arrow key navigation: [Maximizing Code Reuse: Multiple Event Handlers](https://accessexperts.com/blog/2012/10/22/maximizing-code-reuse-multiple-event-handlers/). (*Be sure to check out more of Ben's writing at his [IT Impact author page](https://accessexperts.com/author/bclothier/).)*

In a comment to that article, Ben wrote this describing the problem in detail:

> "In a recordset object, you can’t just “move” to a new record. When you issue a AddNew command on form’s recordset, this mimics the action of typing something in the form’s new record placeholder but that creates several side effects; a new autonumber is incremented, the form is now dirty and so forth."

### SelTop to the rescue

When Ben emailed me to point out the issue with the autonumber incrementing, he also provided me with the solution he uses instead. Rather than use the AddNew method of the form's recordset object, he uses the [form's SelTop property](https://docs.microsoft.com/en-us/office/vba/api/access.form.seltop) to move the focus to the new record.

To the user, the SelTop behavior is the same as the AddNew behavior. Both approaches move the focus to the new record row on the form. But using SelTop neatly avoids the unintentional incrementing of the autonumber field. 

As Ben points out, the "\[n\]ew record placeholder at the end of form’s records is entirely a form artifact." Thus, using the SelTop property of the *form* avoids making unintended changes to the form's *recordset.*

### Before and after

Here's the existing portion of our code that needs to be replaced:

```vba
    Case vbKeyDown
        If Not rs.EOF Then
            rs.MoveNext
            If rs.EOF Then
                If Frm.AllowAdditions Then
                    rs.AddNew
                Else
                    rs.MovePrevious
                End If
            End If
            Ctl.SetFocus
        ElseIf Frm.AllowAdditions Then
            rs.AddNew
        End If
```

And here's the replacement code:

```vba
    Case vbKeyDown
        If Not rs.EOF Then
            rs.MoveNext
            If rs.EOF Then
                If Frm.AllowAdditions Then
                    'Every call to rs.AddNew increments the AutoNumber,
                    '   even if we don't edit the new record;
                    'Setting Frm.SelTop avoids this problem
                    Frm.SelTop = rs.RecordCount + 1
                Else
                    rs.MovePrevious
                End If
            End If
            Ctl.SetFocus
        ElseIf Frm.AllowAdditions Then
            Frm.SelTop = rs.RecordCount + 1
        End If
```

Thanks, Ben!

*Image by [Gábor Adonyi](https://pixabay.com/users/adonyig-4265448/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=3807158) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=3807158)*