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?
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?
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
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.
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.
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.
Will people be using these numbers? Do you paint them on a box or similar?
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.
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.
Thanks, I will do that.
Okay, so now what I need is a way to generate a user-defined number of records automatically.
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.