Solved

How do I create custom sequence number in Microsoft Access?

Posted on 2010-09-14
6
837 Views
Last Modified: 2013-11-28
I have field name AWBNumber, I need that field to be autonumber each time data is entered in that table, the AWBNumber needs to be a 11-digit number, custom sequence, and doesn't repeat itself.
the sequence should be like this:
61000100000 +1
61000100001 +1
61000100002 +1
61000100003 +1
61000100004 +6
61000100010 +1
61000100011 +1
and so on...

Is there any solution for this? Should I use the autonumber data type?
Thanks.
0
Comment
Question by:luisr69
  • 3
  • 2
6 Comments
 

Expert Comment

by:ashish908
ID: 33673520
Access does not support autonumber with defined starting number, so i guess you will have to programmatically control it
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 33673581
AutoNumber is a Long behind the scenes, so it will not support an 11 digit number (Long maxes out at ~2.1 billion).ashish908,The Access UI does not support it, but there are ways to do it nonetheless:http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_20676131.htmlPatrick
0
 

Author Comment

by:luisr69
ID: 33673837
CurrentDb.Execute "ALTER TABLE MyTable ALTER Column CustID Counter (100,5)"
Starts from 100 and increases by 5

in that case above, what would be the data type?
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33673912
>>in that case above, what would be the data type?AutoNumber, but stored as LongAs I already indicated, if you need an 11-digit number, AutoNumber is not an option for you.
0
 

Author Comment

by:luisr69
ID: 33674086
okay, thanks for that.
what about the +6 after four +1 increments?
0
 

Author Closing Comment

by:luisr69
ID: 33717053
Thanks
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now