saving subform data into table

robina

Access Developer
Local time
Today, 03:52
Joined
Feb 28, 2012
Messages
102
I have a main form [Emp_New] and a subform [Class_Catalog subform] my save button is on the main form. When I click save it saves the values in the controls on the main form to the Emp table it is based on. Problem is the subform. It is based on the value in a the txtJobtitle control on the main form which is great. From that value it pulls Class_ID (a text box) from a table named Class_Catalog. It also has a field that simply copies the Emp_ID field (a text box) from the main form. I need the subform to save the Class_ID and Emp_ID into the Classes_taken table when the main form save button is clicked.
Here are the control sources for the controls in the subform:

Class_ID: [Class_ID] (this is from the class catalog table)
Emp_ID: =[Forms]![Emp_New]![txtEmp_ID] (this is from the main form )

I tried adding a save button to the subform but I get the "command or action 'RecordsGotoNew' isn't available now" error.
 
The first subform [Class_Catalog subform] is linked to the main form by the txtjobtitle control. The second subform isn't linked to the main form because it is a list of classes required for everyone and is not dependent on jobtitle. So, its using a query where jobtitle is "all". I need the employee number entered on the main form to show next to each class so that the classID and employee number can then be saved into the Classes_taken table. that's why my subforms aren't bound. I can't figure out how to get the first subform to autopopulate while using a field from the Classes_taken table to save it into.
 
I also wanted to add that I show empID on both subforms because I am saving the record on the main form into the Emp table and i need to also save EmpID with the ClassID shown in both subforms. Thanks again for everyone's help.
 

Users who are viewing this thread

Back
Top Bottom