Results 1 to 5 of 5
  1. #1
    tiger6115 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    9

    Question How can i automatic number for a range of records

    Hello All,

    I am creating an Access 2007 DB and i am wondering what would be the best way to assign an autonumber to a field named Batch# for a range of records. example:

    [ID] [FName] [LName] [SSN] [Batch#]
    1 Jay Smith 123 00001
    ..
    ..
    50 Tom Jones 321 00001
    51 Lou Clark 231 00002
    ..
    ..


    100 Sam I'Am 132 00002
    101 Joe Toe 213 00003

    In essence i need the Batch# to sequentially add 1 for every 50 records.

    Any help is appreciated, Thanks in advance.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Off the top of my head, this should work in a query:

    ([ID]\50)+1
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tiger6115 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    9
    That worked great. Thanks PBaldy

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    No problemo, and welcome to the site!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    tiger6115 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    9
    Thanks for the welcome, I'm loving this site already. I have a quick question. The query is adding +1 on the 50th record, so it breaks down as (1-49, 50-99, 100-149). I have tried changing the 50 in the code to 51 and it breaks down as (1-50, 51-102,...). It's a small thing but is there a way to add +1 after every 50 records? Do I need a count() function? Thanks

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

Similar Threads

  1. Automatic Serial Number in Report
    By jamil_kwi in forum Reports
    Replies: 11
    Last Post: 01-19-2015, 11:09 AM
  2. Automatic Next number generation
    By MicroMan in forum Programming
    Replies: 17
    Last Post: 10-21-2011, 05:57 PM
  3. Replies: 3
    Last Post: 08-26-2010, 02:11 PM
  4. Help On Creating Automatic of a Serial Number
    By lm_lopes in forum Programming
    Replies: 4
    Last Post: 03-10-2010, 06:47 AM
  5. how to convert week number to date range
    By qwang1115 in forum Access
    Replies: 1
    Last Post: 02-13-2009, 11:35 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