Flag for United States of America

asked on 

Numbering Data in a form Sequentially

How do I automatically generate a sequential number sequence and assign it to the rows returned on a form?

I have a table with two columns.  The first column is a Work Order ID that's assigned to multiple samples.  The second column in the Sample ID.  I have a form that will search on Work Order and return the Sample ID's for that work order.  The Sample ID's are numbers, and thus can be sorted numerically.  I want the form to sort these Sample ID's numerically and then assign them the number they are in the sequence.



Example Table with Work Order and Sample ID

I would like the form to return the Sample ID's for Work Order ABC1925.  This would result in the Details section of the form returning:


I would then like to assign each Sample ID with the number they are on the current list.  So it would be:

1        15463
2        15464
3        15465
4        15466

If I closed the form and decided to search for another Work Order, I would want the form to assign the sequence for the new set.  So if I searched by Work Order LMN7643, it would return:

1        21015
2        21016
3        21025
4        21026
5        21032
6        21035

Note that the Sample ID's aren't sequential themselves.  That doesn't matter for my purposes.  I only want them numbered sequentially by descending Sample ID.

Thanks for everyone who read this, I hope you have a great day.
Microsoft Access

Avatar of undefined
Last Comment
Gustav Brock

8/22/2022 - Mon