B
BruceM
The background:
Jobs are performed according to Process Plans. A Process Plan may be for a
particular part number(s), or there may be no specific associated part
numbers. All part numbers are stored in a PartNumber table. A part may be
associated with several Process Plans and vice versa (many-to-many), so
there is a junction table (tjctPlanPart) between tblProcessPlan and
tblPartNumber.
When a job arrives, the user enters the job number, selects a ProcessPlan,
and selects a PartNumber (combo boxes for selection). This information is
stored in tblJob. If the selected ProcessPlan has associated part numbers,
I want the combo box to show just those part numbers. I have that part
worked out:
SELECT tjctPlanPart.PartID_PlanPart, tblPart.PartNum, tblPart.PartDescr,
tjctPlanPart.PlanID_PlanPart
FROM tblPart
INNER JOIN tjctPlanPart
ON tblPart.PartID = tjctPlanPart.PartID_PlanPart
WHERE (((tjctPlanPart.PlanID_PlanPart)=[PlanID_Job]))
ORDER BY tblPart.PartNum;
Again, the combo box using this code is on the Job form. [PlanID_Job] is
the field in which the Process Plan ID is stored. Plan ID is the PK field
in tblProcessPlan; PlanID_Job is the corresponding FK field in tblJob. The
user first selects the ProcessPlan combo box on the Job form. The
PartNumber combo box on the Job table uses that field to filter the results
to just the part numbers associated with that ProcessPlan. There is a
one-to-many relationship from tblPart to tblJob, if that matters for this
situation.
The thing I cannot figure out is what to do if the Process Plan does not
have any associated part numbers (this could happen because the plan is for
a category of part rather than a specific part number). The SQL in that
situation would be to select all of the parts from the Parts table:
SELECT tblPart.PartID, tblPart.PartNum, tblPart.PartDescr
FROM tblPart
ORDER BY tblPart.PartNum;
How do I make it so that the row source is the first code above if the
Process Plan has associated part numbers, and the second if the Process Plan
has no associated part numbers?
Jobs are performed according to Process Plans. A Process Plan may be for a
particular part number(s), or there may be no specific associated part
numbers. All part numbers are stored in a PartNumber table. A part may be
associated with several Process Plans and vice versa (many-to-many), so
there is a junction table (tjctPlanPart) between tblProcessPlan and
tblPartNumber.
When a job arrives, the user enters the job number, selects a ProcessPlan,
and selects a PartNumber (combo boxes for selection). This information is
stored in tblJob. If the selected ProcessPlan has associated part numbers,
I want the combo box to show just those part numbers. I have that part
worked out:
SELECT tjctPlanPart.PartID_PlanPart, tblPart.PartNum, tblPart.PartDescr,
tjctPlanPart.PlanID_PlanPart
FROM tblPart
INNER JOIN tjctPlanPart
ON tblPart.PartID = tjctPlanPart.PartID_PlanPart
WHERE (((tjctPlanPart.PlanID_PlanPart)=[PlanID_Job]))
ORDER BY tblPart.PartNum;
Again, the combo box using this code is on the Job form. [PlanID_Job] is
the field in which the Process Plan ID is stored. Plan ID is the PK field
in tblProcessPlan; PlanID_Job is the corresponding FK field in tblJob. The
user first selects the ProcessPlan combo box on the Job form. The
PartNumber combo box on the Job table uses that field to filter the results
to just the part numbers associated with that ProcessPlan. There is a
one-to-many relationship from tblPart to tblJob, if that matters for this
situation.
The thing I cannot figure out is what to do if the Process Plan does not
have any associated part numbers (this could happen because the plan is for
a category of part rather than a specific part number). The SQL in that
situation would be to select all of the parts from the Parts table:
SELECT tblPart.PartID, tblPart.PartNum, tblPart.PartDescr
FROM tblPart
ORDER BY tblPart.PartNum;
How do I make it so that the row source is the first code above if the
Process Plan has associated part numbers, and the second if the Process Plan
has no associated part numbers?