From: Dorian on
I don't see how you can since there is nothing in your data that links
product to contract.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"moso97ad" wrote:

> Hello,
>
> I have imported two spreadsheets from excel to two temporary tables
> called "import_tbl_contract" and "import_tbl_products". I do this on
> daily basis and import many spreadsheets.
>
> I end up with these data:
>
> [import_tbl_contract]
> contract_number
> contract_title
> start_date
> end_date
>
> [import_tbl_products]
> product_number
> product_text
> price
>
> I now append these data to the following two tables:
>
> [tbl_contract]
> contract_id (PK)
> contract_title
> start_date
> end_date
>
> e.g.
> 1; Syringes and needles; 01-01-2010; 31-12-2010
>
> [tbl_products]
> product_id
> product_number
> product_text
> price
>
> e.g.
> 1; 02030405; syringe 1; dkk 12,00
> 2; 05063004; syringe 2; dkk 10,00
> 3; 74737327; syringe 3; dkk 15,00
>
> I now want to join the data in a junction table:
>
> [tbl_contractdetails]
> contract_detail_id
> contract_id
> product_id
>
> e.g.:
> 1; 1; 1
> 1; 1; 2
> 1; 1; 3
>
> How can I do this, when I on daily basis import many spreadsheets? I'm
> a newbie to SQL and VBA.
>
> Thanks in advance.
>
> Morten
> .
>