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

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?
 
K

Keith Wilby

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
 
R

Ron2005

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top