Results 1 to 11 of 11
  1. #1
    macollins is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    10

    Generate Multiple Records with Autonumbers

    I need to be able to click a button and generate <x> number of records with <x> number of autonumbers, with one assigned to each record. Is that possible?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    With one what assigned to each record.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    macollins is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    10
    One Autonumber. To give context, I need the button to generate a user-defined number of records, assign one autonumber to each record, and put that autonumber in the appropriate field. Its for a company that needs to assign an in-house tracking number to shipping containers.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Can you give us a brief explanation of how these numbers would be used in the business?
    I have a feeling that autonumber is not suited to your needs, but that's only a guess at this time.
    You may wish to read this article.

  5. #5
    macollins is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    10
    The autonumbers will be used as the in-house tracking number for shipments that are coming in, and be used as the primary key. Thanks for the article.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  7. #7
    macollins is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    10
    Yes, they will be printed on forms and used for scheduling. Autonumbers were the best solution we could come up with. I know that's probably not the best solution.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Well as you saw in the UA article - Autonumbers are for system use --not humans.
    Autonumbers are unique ---they are not necessarily positive and not necessarily incremental.

    You may want to look up articles using DMax +1 if you need incremental and positive numbers.

  9. #9
    macollins is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    10
    Thanks, I will do that.

  10. #10
    macollins is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    10
    Okay, so now what I need is a way to generate a user-defined number of records automatically.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You want to generate custom unique identifier.

    Use VBA procedure. Something like:

    For i = 1 to {some number here, can be a reference to a textbox on form}
    CurrentDb.Execute "INSERT INTO tablename(MyID) VALUES(" & DMax("MyID", "tablename") + 1 & ")"
    Next
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 5
    Last Post: 08-24-2013, 02:07 AM
  2. Sub Records & Autonumbers
    By samg2012 in forum Database Design
    Replies: 3
    Last Post: 03-22-2013, 10:01 AM
  3. Auto generate records
    By RokitRod in forum Database Design
    Replies: 1
    Last Post: 10-02-2012, 10:45 AM
  4. Replies: 3
    Last Post: 05-04-2012, 12:04 AM
  5. Generate Multiple Queries per Field value
    By dssrun in forum Programming
    Replies: 1
    Last Post: 02-26-2011, 12:12 PM

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