Full Version: Please Help - Problem With Adding New Records To Subform
UtterAccess Forums > Microsoft® Access > Access Forms
I have a db with a main form containing a subform that is linked using the master/child fields control.
The main form recordsource is a Department table.
The Department record is selected using a combo box.
The related fields are the ID in the Depts table and the Dept ID in the course table.
The subform is based on a query that displays the related records for the selected Dept (ie one Dept runs many courses).
The records in the subform can be edited/added, however when I add a new course record in the sub form
I have to manually select the Dept ID.
Is it possible to have the Dept ID for the new record to automatically link/lookup the selected/related
Department from the Parent form (ie; if the Legal Dept has been selected in the main form then the new course
record should be automatically be for the Legal dept).
What field do you have in the Linked Master/Child Fields?
Just my 2 cents...
tina t
in addition to DBguy's question: you say the subform is bound to a query. is this a multi-table query? Department table and Courses table? if so, you're probably making it more complex than it needs to be. try binding the subform to the Courses table, period. in the mainform, the subform control's LinkChildFields property should be set to thename of the DeptID foreign key field in the Courses table. the subform control's LinkMasterFields property should be set to the name of the control in the mainform that you use to select a dept.
Thanks Tina and BigDbGuy,
Ochanged the master/child field link to deptID and Id (the P/key) and it seems
to be working Ok!
Thanks again <
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.