How can I change a number field to autonumber? I want the new autonumber field to keep the same number as the current number field.
Thank you in advance.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Change field to autonumber (2002)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Change field to autonumber (2002)
- This topic has 3 replies, 2 voices, and was last updated 16 years, 9 months ago.
AuthorTopicViewing 0 reply threadsAuthorReplies-
WSHansV
AskWoody LoungerAugust 12, 2008 at 6:43 am #1120826You can’t change an existing field to an AutoNumber field. You could do the following; this will only be easy if the table isn’t involved in relationships with other tables.
– Select the table in the database window.
– Copy it (Ctrl+C).
– Paste it (Ctrl+V), specify a name and select the option to paste the structure only.– Open the new table in design view.
– If there are indexes involving the number field, delete them.
– Delete the number field.
– Create a new field of type AutoNumber, and give it the same name as the field that you removed.
– Close and save the new table.– Create a query in design view based on the old table.
– Select Query | Append Query and specify the new table as target.
– Drag all fields or * to the query grid. Access should automatically assign the target fields.
– Select Query | Run or click the Run button on the toolbar.
– You can discard the query or save it.– Delete the old table.
– Rename the new table to the name of the old one. -
WSrobinr
AskWoody LoungerAugust 13, 2008 at 2:13 am #1121139I don’t think that would work. I have another idea but don’t know how to do it. The field I want to increment the number in is in a subform. Instead of have an autonumber can I have it take the last number – in the table and add 1 to it?
Thanks Hans for always responding and being such a big help. -
WSHansV
AskWoody LoungerAugust 13, 2008 at 2:25 am #1121140You could use the Before Update event of the subform for this:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim lngID As Long
If Me.NewRecord Then
lngID = Nz(DMax(“ID”, “tblSomething”), 0) + 1
Me.ID = lngID
End If
End SubHere, tblSomething is the name of the table on which the subform is based, and ID is the name of the field that you want to increment.
The disadvantage is that the number will only be assigned when the new record is saved. You could use the Before Insert event instead, but that would be risky in a multi-user environment – two users could easily assign the same number to different records.
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
My Simple Word 2010 Macro Is Not Working (Awaiting moderation)
by
mbennett555
3 hours, 44 minutes ago -
Office gets current release
by
Susan Bradley
8 hours, 28 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
1 day, 1 hour ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
9 hours, 31 minutes ago -
Stop the OneDrive defaults
by
CWBillow
1 day, 1 hour ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 day, 11 hours ago -
X Suspends Encrypted DMs
by
Alex5723
1 day, 13 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
1 day, 14 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
1 day, 14 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
1 day, 15 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
1 day, 3 hours ago -
Enabling Secureboot
by
ITguy
1 day, 10 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
1 day, 23 hours ago -
No more rounded corners??
by
CWBillow
1 day, 19 hours ago -
Android 15 and IPV6
by
Win7and10
1 day, 8 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
2 days, 11 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
2 days, 14 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
2 days, 9 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
2 days, 21 hours ago -
May preview updates
by
Susan Bradley
2 days, 9 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
2 days ago -
Just got this pop-up page while browsing
by
Alex5723
2 days, 13 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
2 days, 11 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
1 day, 13 hours ago -
At last – installation of 24H2
by
Botswana12
3 days, 13 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
11 hours ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
4 days, 1 hour ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
1 day, 23 hours ago -
Limited account permission error related to Windows Update
by
gtd12345
4 days, 14 hours ago -
Another test post
by
gtd12345
4 days, 15 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.