I am working on a database for inventory of a laboratory. Currently there is a table that defines samples, 'Samples'. This includes a primary key, sample ID, subject demographics, among others, and a numeric field of test tubes belong to a sample 'TubeNumber'. This table must remain intact because I don't manage it and a lot of other important queries link to it. The inventory is getting out of hand and we now would like to track each test tube individually. For example, a patient may get blood drawn that results in 8 test tubes of plasma. I have created a table called 'Tubes' that will hold all the information specific to a tube.
What I want to do is to go through the existing Samples table and create X number of records in the Tubes table depending on TubeNumber. So for our exmaple some function would lookup TubeNumber, which is 8, and create 8 records in the Tubes table.
Is there a way to do this with a query, or do I need to write some VB code? I know it can be done with some for loops, any other functions that might be useful?
What I want to do is to go through the existing Samples table and create X number of records in the Tubes table depending on TubeNumber. So for our exmaple some function would lookup TubeNumber, which is 8, and create 8 records in the Tubes table.
Is there a way to do this with a query, or do I need to write some VB code? I know it can be done with some for loops, any other functions that might be useful?