Snowflake68
Registered User.
- Local time
- Today, 22:13
- Joined
- May 28, 2014
- Messages
- 464
Hi I have a table which has over 50 fields and I need to update the Operation number field with a new number putting them in reverse order.
There are over 2000 unique codes all of which have multiple records with various different information. (This is how is it set up in the ERP system so I am not able to change this)
So for example code 102655 has 28 records with Operation numbers 101 to 306 but I need to reverse the order and number them 1 to 28.
I know that I can append them into a new table in reverse sort order but how to I renumber the Operation number. I was thinking of somehow obtaining the record number as the new operation number but that will only work if I run the append query separately for each individual code but there are over 2000 of them so this is not really an option.
I was hoping that perhaps there was some VBA function that could be written that takes each code individually and then runs the append query updating the Operation number as it goes.
I have attached an example of one of the codes showing the current operation number and the new operation number that I what to obtain.
Hope someone can help.
There are over 2000 unique codes all of which have multiple records with various different information. (This is how is it set up in the ERP system so I am not able to change this)
So for example code 102655 has 28 records with Operation numbers 101 to 306 but I need to reverse the order and number them 1 to 28.
I know that I can append them into a new table in reverse sort order but how to I renumber the Operation number. I was thinking of somehow obtaining the record number as the new operation number but that will only work if I run the append query separately for each individual code but there are over 2000 of them so this is not really an option.
I was hoping that perhaps there was some VBA function that could be written that takes each code individually and then runs the append query updating the Operation number as it goes.
I have attached an example of one of the codes showing the current operation number and the new operation number that I what to obtain.
Hope someone can help.