What you need is a form in single form view based on the Kit table, and
within it a subform in continuous forms view based on a query which joins the
PartKit and Kit tables. The subform should include a form footer section.
The subform is linked to the parent form on the Kit fields.
One amendment you'll need to make to your model is to add a Quantity field to
the PartKit table, assuming a Kit might have more than one of each part.
This can then be used to compute the cost.
The query on which the subform is based would be:
SELECT PartKit.[Part Number], Quantity, Description, Cost
FROM Part INNER JOIN PartKit
ON Part.[Part Number] = PartKit.[Part Number]
ORDER BY PartKit.[Part Number];
The PartKit subform would have the following controls:
1. A combo box bound set up as follows:
Name: cboPart
ControlSource: [Part Number]
RowSource: SELECT [Part Number], Description, Cost FROM Part ORDER BY
[part Number];
BoundColumn: 1
ColumnCount: 3
ColumnWidths: 2cm;4cm;2cm
ListWidth: 8cm
Access will convert the dimensions to inches if you are not using metric
units. Experiment with the ColumnWidths dimensions to get the best fit. The
ListWidth is the sum of the column widths.
2. A text box to show the description with a ControlSource of: [Description].
Set its Locked property to True (Yes) and its Enabled property to False (No)
3. A text box to show the unit cost with a ControlSource of: [Cost]. Set
its Locked property to True (Yes) and its Enabled property to False (No)
4. A text box with a ControlSource of:
[Quantity]
5. A text box to show the gross cost per part, with a ControlSource of:
=[Quantity] * [Cost]
6. A text box in the footer to show the gross cost of the kit with a
ControlSource of:
=Sum([Quantity] * [Cost])
Ken Sheridan
Stafford, England
I've now made my three tables;
Part, with fields; / Part Number / Description / Cost
Kit, with field / Kit/
and to link them;
PartKit with fields /Kit / Part Number/
and i've got the one-many relationships between the tables.
I can make the form to input the new parts, but I'm stuck with how to make a
form to create a new kit
Take a look at the demo at:
[quoted text clipped - 28 lines]
--
Message posted via AccessMonster.com
.