I have a table [QUANTITY] with the following fields:
CatNum, LocID, MinQty, LocStored
CatNum is the foreign key to another table.
Each CatNum needs to be listed 4 times with the following different LocID fields:3S, 3R, 2C, 2S
Example #1:
[CatNum] [LocID] [MinQty] [LocStored]
888 3S 2 Locker2
888 3R 1 Shelf3B
888 2C 0 Shelf3F
888 2S 0 Shelf1D
999 3S 0 Locker3
999 3R 4 Shelf3A
999 2C 0 Shelf2C
999 2S 1 Shelf1B
Currently some CatNum's are listed as only 1 or 2 records with [LocID] null in some casses.
Example #2:
[CatNum] [LocID] [MinQty] [LocStored]
888 3S 2 Locker2
888 2C 0 Shelf2C
900 2S 0 Shelf1D
910
999 3S 0 Locker3
999 3R 4 Shelf3A
999 2C 0 Shelf2C
999 2S 1 Shelf1B
Is it possible to write a query or code to add records to the table to ensure that each CatNum is exactly4 records with the different required LocID's?
It would need to check for how many CatNum records exist and what if any data is in the LocID fields. The Existing data must remain intact with the exception of null [LocID] fields need to be populated.
Thanks for any suggestions or help.
Brent
CatNum, LocID, MinQty, LocStored
CatNum is the foreign key to another table.
Each CatNum needs to be listed 4 times with the following different LocID fields:3S, 3R, 2C, 2S
Example #1:
[CatNum] [LocID] [MinQty] [LocStored]
888 3S 2 Locker2
888 3R 1 Shelf3B
888 2C 0 Shelf3F
888 2S 0 Shelf1D
999 3S 0 Locker3
999 3R 4 Shelf3A
999 2C 0 Shelf2C
999 2S 1 Shelf1B
Currently some CatNum's are listed as only 1 or 2 records with [LocID] null in some casses.
Example #2:
[CatNum] [LocID] [MinQty] [LocStored]
888 3S 2 Locker2
888 2C 0 Shelf2C
900 2S 0 Shelf1D
910
999 3S 0 Locker3
999 3R 4 Shelf3A
999 2C 0 Shelf2C
999 2S 1 Shelf1B
Is it possible to write a query or code to add records to the table to ensure that each CatNum is exactly4 records with the different required LocID's?
It would need to check for how many CatNum records exist and what if any data is in the LocID fields. The Existing data must remain intact with the exception of null [LocID] fields need to be populated.
Thanks for any suggestions or help.
Brent