How to populate all fields on subform with combo box data from main form
Posted on 2011-03-02
I need to automatically fill in new records in a subform (frmQuality_Review_Subform) based on the selection in a combo box (cboAuditType) on the main form (frmEmployee_Audits). When the user chooses a selection from the cboAuditType combo box on the main form, it needs to look up values in a table called "tblEnrollment_Dept_Criteria_Codes" and fill in the fields on the subform from this table where the cboAuditType selected from the combo box from the main form, matches the Audit_Type in the "tblEnrollment_Dept_Criteria_Codes" and poplulate the fields appropriately.
The code needs to populate the subform with all the data that is found in the table where the Audit Types match in both the table and form. So for instance, if there are 10 records in the table where the Audit Type matches the Audit Type selected on the main form combo box, then the subform needs to be populated with 10 records.
I need to fill in the following fields into the new records on the subform. The subform is a datasheet form and the main form is a single form.
Fields to fill in:
Field in Table POPULATES Field on subform
Quality_Review_Criteria -----> Subcode
Possible Score -----> Possible_Score
Audit Score -----> Audit_Score
Region -----> Region
InquiryNum -----> InquiryID
cboEmployee -----> Employee
Sorry if I repeat myself, I'm just trying to make it clear.