OK here goes. I have three tables:
Products, Suppliers and ProductSupplierJoin.
Products has the following fields among others:
ProductID - Key field
VendorProductID Indexed No duplicates
Suppliers has the following field among others
SupplierID - Key field
ProductSupplierJoin has the following fields
ProductID
SupplierID
The relationships are as follows Products is linked to ProductSupplierJoin via ProductID 1 to many
Suppliers is joined to ProductSupplierJoin via SupplierID 1 to many.
The join table is so I can account for more than one supplier supplying the same VendorProductID. Actually I thinking of renaming that field since I really hold the ManufacturerID.
I have a combo box which has a rowsource that selects records from Products which have a corresponding record for the supplier in ProductSupplierJoin so I get on Products supplied from that supplier.
If this supplier has not in the past supplied this particular product I need to add it the the list of products supplier by this supplier; however, I also need to check to see if this product is supplied by any other supplier (ei. Has a record in Products). So here is my Dlookup problem.
In the notonlist event property I have the following code to check if the product alreadys exist in the product table.
If Not IsNull(DLookup("[VendorProductNo]","Products","[VendorProductNo] = '" & Me![ProductID].Column(1) & "'")) Then
etc. etc. I add the record dynamically to the ProductSupplierJoin table and continue.
Problem is that even when I enter a product which exists in the Products table but hasn't been supplied by this particular supplier it skips to the statement where it run a products entry screen to add the "new" product.
I know there is something I'm missing but not sure where.
Can anyone help.
Products, Suppliers and ProductSupplierJoin.
Products has the following fields among others:
ProductID - Key field
VendorProductID Indexed No duplicates
Suppliers has the following field among others
SupplierID - Key field
ProductSupplierJoin has the following fields
ProductID
SupplierID
The relationships are as follows Products is linked to ProductSupplierJoin via ProductID 1 to many
Suppliers is joined to ProductSupplierJoin via SupplierID 1 to many.
The join table is so I can account for more than one supplier supplying the same VendorProductID. Actually I thinking of renaming that field since I really hold the ManufacturerID.
I have a combo box which has a rowsource that selects records from Products which have a corresponding record for the supplier in ProductSupplierJoin so I get on Products supplied from that supplier.
If this supplier has not in the past supplied this particular product I need to add it the the list of products supplier by this supplier; however, I also need to check to see if this product is supplied by any other supplier (ei. Has a record in Products). So here is my Dlookup problem.
In the notonlist event property I have the following code to check if the product alreadys exist in the product table.
If Not IsNull(DLookup("[VendorProductNo]","Products","[VendorProductNo] = '" & Me![ProductID].Column(1) & "'")) Then
etc. etc. I add the record dynamically to the ProductSupplierJoin table and continue.
Problem is that even when I enter a product which exists in the Products table but hasn't been supplied by this particular supplier it skips to the statement where it run a products entry screen to add the "new" product.
I know there is something I'm missing but not sure where.
Can anyone help.
