It appears that the refurbdetail TABLE is a list of products
associated with a refurb.
In a situation like that, unless you are doing something
weird with the product description, tblreferbdetail only
needs two fields:
referbdetailID (Autonumber? primary key)
ProductID (Long Foreign key)
You can include SupplierID in there if you think it will
help somewhere else, but a query can get the SupplierID from
the product table using the ProductID. OTTH, you do not
want the product name, description or serial number fields
in tblreferbdetail as they would duplicate the information
in the product table.
The table could, of course, have other fields for data
specific to the refurbdetail (e.g. refubdate, work estimate.
etc).
Given all that, the subform would have (at least):
txtreferbdetailID
Visible No
ControlSource referbdetailID
CBOSupplier:
Row Source:
SELECT SupplierID, SupplierName
FROM tblSuppliers
Column Count 2
Bound Column 1
ColumnWidths 0;
Control Source SupplierID
CBOProduct:
Row Source:
SELECT ProductID, ProductName,
ProductDescription, ProductSerialNum
FROM tblProducts
WHERE SupplierID =
Forms!frmrefurb.frmrefurbsubform.Form.CBOSupplier
Column Count 4
Bound Column 1
ColumnWidths 0;;0;0
Control Source ProductID
txtProductDescr:
ControlSource =CBOProduct.Column(2)
txtSerialNum
ControlSource =CBOProduct.Column(3)
--
Marsh
MVP [MS Access]
I have removed the original code etc so I now have an frmrefurb and
frmrefurbsubform. Here are the details of the combo boxes
The subform is where I have the combo boxes in datasheet view I have
referbdetailID
Supplier Name
ProductID
Product Description Name
Row Source:
SELECT DISTINCT tblProducts.SupplierID,
tblSuppliers.SupplierName
FROM tblSuppliers INNER JOIN tblProducts
ON tblSuppliers.SupplierID=tblProducts.SupplierID;
Column Count 2
Bound Column 2
Control Source SupplierName
Row Source:
SELECT tblProducts.ProductID, tblProducts.ProductName
FROM tblProducts;
Column Count 2
Bound Column 1
Control Source ProductID
Row Source:
SELECT tblProducts.ProductDescription
FROM tblProducts;
Column Count 1
Bound Column 1
Control Source ProductDescription