3 minutes ago: I made a few modifications to the website yesterday so if you see any JavaScript errors let me know. Thanks.  Dismiss
Free Lessons
Fast Tips
Topic Index
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Home > TechHelp > Directory > Access > Sequential Numbers < Deleted AutoNumber | Customer Codes >
Sequential Numbers
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   4 years ago

Create Sequential Numbering to Replace OrderID AutoNumbers

 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark Join Now

In this tutorial you will learn how to create your own custom order number that you can start at whatever value you want and have Access automatically increment the values so you have nice sequential order numbers that have no gaps. 

Timothy asks, "I’m using an AutoNumber for OrderID in my table, like you taught me, but my accountant wants me to have sequential numbers for reporting purposes. What should I do?"


I'll show you how to replace NULL with Order Number values for existing records. We'll talk about problems with multi-user databases and see how to save that new number to the table immediately to avoid conflicts, and we'll learn how to make a Custom Order Number sequence for each Customer, so for example XYZ Company's invoices will be numbered: XYZ-001, XYZ-002, XYZ-003, etc. And of course we'll assign Customer Codes that are unique and alphanumeric.

Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the database template from class plus get access to the Code Vault. If you signed up on YouTube you have to register on my YouTube Find User page so I can set up your account here on my web site. If you're not a member, Join Today!


If you start off with a table that already has data in it, the code in the video works just fine. However, if you start with an empty table, you'll get an error. The solution:

In the BeforeInsert event, wrap the DMax function inside Nz:

OrderNumber = Nz(DMax("OrderNumber", "OrderT"),0) + 1

That will now set OrderNumber equal to ZERO if there aren't any records.


Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates


Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted


Please feel free to post your questions or comments below or post them in the Forums.


Comments for Sequential Numbers
Age Subject From
13 monthsQuestion for VBA BeginnerFaith Harvey
2 yearsIm StuckSandra Truax
2 yearsConfused on VideosThomas Gonder
2 yearsExtended CutRamona Woitas
3 yearsQuestion on Extended Cut VideoDavid Britz
3 yearsCounter with No RecordsRichard Rost


Start a NEW Conversation
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
Subscribe to Sequential Numbers
Get notifications when this page is updated

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
My Account
My Courses
Lost Password
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Customer Support
Web Site Tour
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 2/22/2024 12:28:02 PM. PLT: 1s
Keywords: TechHelp Access counter Create Your Own Custom Sequential Automatically Incrementing Number with DMAX counter consecutive  PermaLink  Custom Sequential Numbers in Microsoft Access