How do I link a subform & form so the linking field is updated?

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

Guest

I am building a database to track our organization's training requirements.
I have a tabbed form with the data spilt in catergories (separate tabs). The
employee name & user_id (primary key) reside on the DETAIL section of the
form (not on the tabbed sections). I have created a subform and placed that
on a tab (training), as one employee will have many trainings. Also created
a "Add Course" button on the training subform. How do I go about getting the
user_id to updated automatically on the subform based upon the open record of
the form?
 
Jonathan Hargett said:
I am building a database to track our organization's training requirements.
I have a tabbed form with the data spilt in catergories (separate tabs).
The
employee name & user_id (primary key) reside on the DETAIL section of the
form (not on the tabbed sections). I have created a subform and placed
that
on a tab (training), as one employee will have many trainings. Also
created
a "Add Course" button on the training subform. How do I go about getting
the
user_id to updated automatically on the subform based upon the open record
of
the form?

Use the "link master/child field" properties to link the subform to the form
with the primary/foreign key fields.

Keith.
www.keithwilby.com
 
If the form that is called is not truely a master/child form
relationship then the alternative is that on the "before insert" event
on the called form you need to add code to do the equivalent of moving
the key fields to the new record.

Either save the values you need to hidden text boxes (or txt boxes on a
hidden form) when you press the add button and have the before insert
event reference those txt boxes
or
have the called form reference back to the calling form and/or subform.

If you use the first method with a whole hidden form, then you can
reuse the add course form from any form where it may be useful since
the information it needs is available all the time.

Ron
 
Back
Top