As always, the important thing is to get the model right first. The implication in your post is that all items per shipment are manufactured by the same manufacturer. Assuming that to be the case the model would, in broad outline, comprise
the following tables:
Customers
….CustomerID (PK)
….Customer
….etc
Manufacturers
….ManufacturerID (PK)
….Manufacturer
….etc
Shippers
….ShipperID (PK)
….Shipper
….etc
Shipments represents a ternary many-to-many relationship type between the above tables, so is modelled by a table which resolves the relationship type into three one-to-many relationship types:
CustomerShipments
….CustomerShipmentID (PK)
….CustomerID (FK)
….ManufacturerID (FK)
….ShipperID (FK)
….ShipmentDate
….ItemNumber
….etc
Items are modelled by table which references CustomerShipments like this:
Items
….ItemID (PK)
….CustomerShipmentID (FK)
….Item
….etc
All non-key columns in the above tables must of course be functionally determined solely by the key of each table.
The user interface is a standard one of a CustomerShipments form, in single form view, within which is an Items subform, in continuous forms view, linked to the parent form on CustomerShipmentID. In the parent form the controls bound to the CustomerID,
ManufacturerID and ShipperID. The subform would have controls bound to the Item column and any other columns representing attributes of the item.
To number the rows inserted in the subform assign a value to the subform's bound ItemNumber control's DefaultValue property in the subform's Current event procedure as follows:
Dim strCriteria As String
strCriteria = "CustomerShipmentID = " & Nz(Me.Parent.CustomerShipmentID, 0)
Me.ItemNumber.DefaultValue = """" & _
Nz(DMax("ItemNumber", "Items", strCriteria), 0) + 1 & """"
For reporting purposes a CustomerShipments parent report would be based on a query which joins the CustomerShipments, Customers, Manufacturers and Shippers tables. Within the parent report would be a subreport based on Items, linked to the parent report
on CustomerShipmentID.
Ken Sheridan, Stafford, England