benkingery
Registered User.
- Local time
- Today, 08:18
- Joined
- Jul 15, 2008
- Messages
- 153
I have a delimited file that I'm importing into a table (easy enough). This delimited file contains records that need to be split into two separate tables. 1) An Order Header table, and 2) an Order Detail table. Normally this would be easy enough, however I'll need to join these tables back up with a query, so I need the Order Detail table to contain a foreign reference to the Order Header table. Here is what the data looks like in its raw form.
IH|AF374556|2006-06-05|Bob Smith|3 Berk St||Boston|MA| 02199
ID|4056|4|55.50|Floor Lamp|Ground|Test Comment
ID|BC456|1|17.75|Hall Lamp|Ground|Test Comment 2
"IH" indicates that the record is a header record and "ID" indicates that it is a Detail record. Every "ID" that DIRECTLY follows an "IH" belongs to the "IH" above. That said, I want to use the second value in "IH" record (AF374556) as the foreign reference in the detail lines.
Does someone know how to systematically add the foreign value to the related lines? Either through query, or code? Obviously if my data set was this small, I'd add it manually, but I will likely be dealing with hundreds of "IH", "ID" records at a time and doing this on a daily basis, so that's kind of out of the question.
Thanks for your attention.
IH|AF374556|2006-06-05|Bob Smith|3 Berk St||Boston|MA| 02199
ID|4056|4|55.50|Floor Lamp|Ground|Test Comment
ID|BC456|1|17.75|Hall Lamp|Ground|Test Comment 2
"IH" indicates that the record is a header record and "ID" indicates that it is a Detail record. Every "ID" that DIRECTLY follows an "IH" belongs to the "IH" above. That said, I want to use the second value in "IH" record (AF374556) as the foreign reference in the detail lines.
Does someone know how to systematically add the foreign value to the related lines? Either through query, or code? Obviously if my data set was this small, I'd add it manually, but I will likely be dealing with hundreds of "IH", "ID" records at a time and doing this on a daily basis, so that's kind of out of the question.
Thanks for your attention.