Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1059987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:15:24+00:00 2026-05-16T18:15:24+00:00

I need to generate unique invoice numbers for my Access (2010) database. The numbers

  • 0

I need to generate unique invoice numbers for my Access (2010) database. The numbers should be in the format year+sequential number, e.g. 20101447 for the 1447th invoice of 2010. I looked around for a while, but a lot of the Google results suggest using an autonumber and I’m quite certain that’s not a very solid way of doing it. (because autonumbers are only guaranteed to be unique, nothing else)

The database isn’t going to be used by multiple users at once for now, but I don’t feel like going with a totally hacked together solution either.

EDIT
I also found this website that discusses sequential numbering using the DMax function. Scenario #2 is exactly what I had in mind, and I think it’s good enough for my use case. I’ll make sure the user is notified in the rare (for me) event that the database got changed before completely entering and saving a new invoice.

EDIT2
FYI: The numbering scheme isn’t a fiscal requirement, but just our custom numbering. I didn’t want to change without a good reason to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:15:25+00:00Added an answer on May 16, 2026 at 6:15 pm

    If you have the ability to change the database schema:

    • Add a sequential number field and a
      year field.
    • To get the invoice number, combine
      these values appropriately.
    • When inserting, you will have to get
      the current year and then query the
      database for the maximum sequential
      number where year = current year.
    • Use these values on your insert.

    If you can’t change the database schema:

    • Get the max invoice number where
      invoice number starts with current
      year
    • Increment the invoice number.
    • Use these values on your insert.

    EDIT

    If you can add another table, have a table that stores the ‘max’ sequential number for each year. Every insert will lock the table, get the value and then increment it. Think of it as your invoice number generator table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to solve the following question which i can't get to work by
I need to develop a file indexing application in python and wanted to know
I am trying to load a html page through UIWebview.I need to disable all
i have a input tag which is non editable, but some times i need
We manage a site for a medical charity. They have a number of links
I have several USB mass storage flash drives connected to a Ubuntu Linux computer
This is beyond both making sense and my control. That being said here is
Is there a way to test if a collection is already initialized? try-catch only?
I have a login.jsp page which contains a login form. Once logged in the
I have a snippet to create a 'Like' button for our news site: <iframe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.