Solved

How do I create custom sequence number in Microsoft Access?

Posted on 2010-09-14
6
836 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

863 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

22 Experts available now in Live!

Get 1:1 Help Now