Results 1 to 8 of 8
  1. #1
    RobV is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Plymouth UK
    Posts
    2

    Post I would like to know how to generate a series of number increasing by one


    I need to find a way of generating an incremental number in a series of fields on an existing database. There will be two series one generating a number from 1 to 49999 and a secon series generating a number from 50000 to 99999. I have only basic knowlege of Access so help is definately needed.

  2. #2
    joelmeaders is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    33
    Need more information.

    Is this all going to happen in a table or multiple tables?
    Are all numbers permanently tied to a record?
    Is this a one time event or will it happen multiple times?

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664

  4. #4
    RobV is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Plymouth UK
    Posts
    2

    Reply: Joel, thanks for your response.

    The database is currently used for booking in work and has all the usual fields. We now have to include a unique reference number which consists of two five digits fields The first one is easy generated from a drop-down field. The second one is the 'difficult' one in that it must be a unique number between 00001 and 49999 and at another geographical location on a separate database from 50000 to 999999. Both fields will then provide a unique reference number for each job. Hope this makes sense and thanks for your time. Rob

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Can you give an example of the FULL field as you want it to appear. I'm getting a bit lost by your description is it a 3 part number that you want for your end result i.e.

    [CustomerNumberFromDropDownBox]-[Incrementing Number Between 1 and 49999]-[Lookup Value from Geo Coded Table]

    i.e.
    1-00001-50000
    1-00002-50000
    1-00003-50000
    1-00001-60000
    1-00001-60000
    2-00001-50000
    2-00002-50000
    2-00003-50000

    where the 'counter' is reset for each customer for each geo code

    Or is it strictly

    [Incrementing Number Between 1 and 49999]-[Lookup Value from Geo Coded Table]

    i.e.
    000001-50000
    000002-50000
    000003-50000
    000001-60000
    000002-60000

    again assuming you want to restart the count portion of the filed based on the geo code.

    How are you looking up your geo code? are you choosing it from a combo box or are you retrieving a value from a table based on some other criteria on your data entry form?

  6. #6
    bcmarshall is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    95
    I'm not sure if this will help or not. I have a routine that will create a million records in a few seconds. You can simply limit it in the criteria expression to whatever range you want.

    You can create a table [tbl09] with a single numeric field [num] and 10 records with values 0 - 9.
    Add this one table into a query many times to create a SQL statement like following to create 1,000,000 records


    SELECT [tbl09].[Num]+([tbl09_1].[Num]*10)+([tbl09_2].[Num]*100)+([tbl09_3].[Num]*1000)+([tbl09_4].[Num]*10000)+([tbl09_5].[Num]*100000) AS Numbers FROM tbl09, tbl09 AS tbl09_1, tbl09 AS tbl09_2, tbl09 AS tbl09_3, tbl09 AS tbl09_4, tbl09 AS tbl09_5 ORDER BY [tbl09].[Num]+([tbl09_1].[Num]*10)+([tbl09_2].[Num]*100)+([tbl09_3].[Num]*1000)+([tbl09_4].[Num]*10000)+([tbl09_5].[Num]*100000);

    Just paste the SQL into a blank query after creating the table, and then limit the output in the criteria.

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I don't think he's after creating a bunch of records at once, only when a new project is started. We'll have to wait for a response.

  8. #8
    bcmarshall is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    95
    It was a little hard to tell. If he wanted to create them one at a time he could use autonumber or DMax +1, so maybe I missed his purpose. The routine I offered works great for creating the sequentially numbered records. He could create them and append them, also. It was just a shot in the dark, but it's very handy if you ever need to create a whole bunch of records!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Generate auto number like 100011,100012...
    By lizzywu in forum Access
    Replies: 6
    Last Post: 11-12-2011, 01:43 PM
  2. Replies: 1
    Last Post: 07-26-2011, 06:10 AM
  3. Auto generate reference number
    By JonB1 in forum Import/Export Data
    Replies: 1
    Last Post: 02-19-2011, 06:38 AM
  4. Forecast Query with stepwise increasing year
    By theracer06 in forum Queries
    Replies: 1
    Last Post: 08-12-2010, 06:08 PM
  5. Increasing values
    By Underworld in forum Access
    Replies: 4
    Last Post: 02-24-2010, 03:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums