So you have 3 tables:
- Customer, with CustomerID primary key
- ServiceOrder, with ServiceOrderID primary key, and CustomerID foreign
key;
- PartsUsed, with ServiceOrderID foreign key.
That is, you have a one to many relation:
- between Customer and ServiceOrder (based on CustomerID)
- between ServiceOrder and PartsUsed (based on ServiceOrderID.)
If that is so, you can have:
- main form bound to Customer table.
- a subform bound to ServiceOrder table.
- another subform bound to the PartsUsed table.
On the Customer form, place a text box, and set its Control Source to:
=[ServiceOrder].[Form].[ServiceOrderID]
If you still get #Name, you need to change these name to match. Instead
of
ServiceOrder, use the name of your subform control. Also, make sure the
is a
text box in the subform for ServiceOrderID (even if you set its Visible
property to No.)
Once you get that working, you can then use the name of that text box in
the
Link Master Fields property of the 2nd subform control.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Thanks for responding, I tried what you told me but I am having
problems
getting them to connect. It says name?? in the part used child link
record
when I am in form view. I think I might have mislead on what I want. So
I
will explain myself and you tell me whether or not I have the right
idea.
I want to have the main form based on the customer table and use a Find
combo box to pull up the customer and his information. I want to attach
the
Service Order Form as the first subform. I want it to be Continuous so
I
can
see all of the service that customer has had in the past. Then I want
to
be
able to select a certain service order and click on the next tab over
and
look at the Parts Used on that service order.
Is there a better way? Should I include the parts used on the Service
Order
form and forget about a second subform? I ve heard of being able to
expand
a
record in continuous to a full single record so you can see the whole
thing
if interested. Would this be better.
Your opinion would be greatly appreciated. Thanks Dustin
:
So you have3 tables:
- ServiceWork, with ServiceWorkID primary key
- ServiceOrder, with ServiceOrderID primary key, and ServiceWork
foreign
key.
- PartsUsed, with ID primary key, and ServiceOrderID foreign key.
Your main form is bound to ServiceWork, and it has 2 subforms on it
(not
a
subform within a subform.)
Add a text box to the main form, and set its Control Source to:
=[ServiceOrder].[Form].[ServiceOrderID]
Set its Name property to:
txtServiceOrderID
(Be sure to use the name of your subform control for ServiceOrder, and
the
name of the text box bound to ServiceOrderID for that name.)
Now set the Master Link Fields property of the PartsUsed subform to:
txtServiceOrderID
When you move record in the first subform, Access will update the text
box
on the main form, and will then reload the 2nd subform.
There is an example of this kind of form in the Northwind sample
database:
the Customer Orders form.
Oh, and if you have difficulty in filtering the main form by a field
in
the
subform, this may help:
http://allenbrowne.com/ser-28.html
I am trying to make a form that records service work on customers
units.
End
goal for me is to be able to locate the customer using his units
serial
number in combo box locator. Then in the first subform the service
order
of
can be made of what was done. And then finally go to the parts used
subform
and select the parts used.
I am stuck trying to get the parts used subform to link with the
service
order subform? Access will only let me connect the the Parts Used
sub
to
the
Main. How do I get the Parts Used Sub to follow the Service Order
Sub?
Any suggestions would be great! Thanks Dustin