Update the Foreign Key

Mahoney

Registered User.
Local time
Today, 00:18
Joined
Feb 4, 2009
Messages
28
Hello,

I am currently working on a DB, where the main table is linked to many other tables, the main table is linked to the other tables in the foreign keys.
The main table has information of a product which is required to be produced for a client, and another table the dispatch has information on the dispatch details of the product when it gets finished.
If in the process i still do not have have any information on the dispatch yet, and i want to know what is not shipped yet, (by a query) i am not being able to filter the non shipped products from the dispatch table, because it still does not have the record in for the produced products in it yet. so i am wondering if possible, to once a new record is created in the main table, that its related record in other corresponding tables be created automatically
 
If all you want to do is report on the products that do not have a record yet in the dispatch table, you would be better served to use a query, unless you really do want to add every Product as it is created..

The query uses two tables: tblProducts and tblProductDispatch - where ProductID is foreign key field in tblProductDispatch.

Query to show all Products that do not have a record on tblProductDispatch:

Code:
SELECT tblProducts.ProductID
FROM tblProducts LEFT JOIN tblProductDispatch ON tblProducts.ProductID = tblProductDispatch.ProductID
WHERE (((tblProductDispatch.DispatchID) Is Null));
 
Many thanks Cameron, worked great :D
 

Users who are viewing this thread

Back
Top Bottom