Linked Forms don't auto fill association (only in subform!)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When i create a table and do a 1 to many, i just click the plus sign to see
the many people who work at a specific company, and type in the contact info
without having to type in the company they work for (very nice)

However,

When i create a table (consisting of only the company info) and create a
linked table (to show only the employee names for that specific company) they
are not associated with that company unless i type in the company they work
for. (Not very nice since i need the form view due to the amount of info.

How do i resolve this issue where i can type the info in the employee form
and have it recognize it is suppose to automaically put in the company name
to create an association like in the table view?

However,

If i have the linked forms in the same window (subform option) then no
problem, but i prefer the other view where the windows are seperate.
 
Adam Lejak said:
When i create a table and do a 1 to many, i just click the plus sign to see
the many people who work at a specific company, and type in the contact info
without having to type in the company they work for (very nice)

However,

When i create a table (consisting of only the company info) and create a
linked table (to show only the employee names for that specific company) they
are not associated with that company unless i type in the company they work
for. (Not very nice since i need the form view due to the amount of info.

How do i resolve this issue where i can type the info in the employee form
and have it recognize it is suppose to automaically put in the company name
to create an association like in the table view?
However,

If i have the linked forms in the same window (subform option) then no
problem, but i prefer the other view where the windows are seperate.

A common misconception is that Access even has anything called a "linked form".
The only forms that automatically inherit data from other forms are (as you have
seen) embedded subforms where the MasterLink and ChildLink properties perform
this functionality.

What most people describe as a linked form is simply a form that is opened from
another form pre-filtered to a set of records having a relationship to a field
or fields in the first form. Once opened however; the second form is nothing
more than a form with a filter applied. That filter does nothing to control or
influence the data in any NEW records that might be created in the form.

Now, the developer can use properties of the second form and/or VBA code to
simulate a link and influence new records, but there is nothing built in that
will automatically make that happen.

If the second form (Employees) will *always* be used only when the parent form
(Companies) is also opened, then you can set the DefaultValue property of the
CompanyID to...

=Forms!Companies!CompanyID

If you ever navigate to a new record in the Employees form when the Companies
form is not opened that DefaultValue property would cause an error. If that's a
problem because you sometimes need to use the Employees form by itself to create
new records then you can leave the DefaultValue property set to a blank entry
and when opening the form from the Company form you can use code to temporarily
set the DefaultValue property...

DoCmd.OpenForm "Employees"
Forms!Employees!CompanyID.DefaultValue = Me!CompanyID
 
Back
Top