Others

Store Subform Data in a Microsoft Access Main Form Relationship

Khadija KhanKhadija Khan Nov 13, 2026 869 views

Question details

The user wants to associate subform records with a student without repeatedly storing the student's name.

Store Subform Data in an Access Main Form Relationship
Product
Microsoft Access
Device & OS
not provided
Scenario
A main form displays a pupil, while a related form or subform stores records associated with that pupil.
Observed behavior
Related records should store the pupil's identifier and display the student's name when needed.
Before you start

Confirm that the Pupils table has a unique PupID primary key and that the related Data table has a compatible PupID foreign-key field. If Pupils.PupID is an AutoNumber, use a Number field with the Long Integer field size for Data.PupID.

Solution 1Recommended

Link the main form and subform using PupID

Use this method when the main form displays a pupil and the subform holds that pupil's related records.

1
Create the relationship

Open Database Tools > Relationships, add the Pupils and Data tables, and drag Pupils.PupID to Data.PupID. Select Enforce Referential Integrity and click Create.

2
Set the form sources

Open the main form in Design View and use its Property Sheet to set its Record Source to Pupils. Open the subform in Design View and set its Record Source to Data or a query based on Data.

3
Link the subform control

In the main form's Design View, select the subform control and open its Property Sheet. Set Link Master Fields to PupID and Link Child Fields to PupID.

4
Test a related record

Open the main form in Form View, select a pupil, and add a record in the subform. Save the record and check the Data table: its PupID should match the pupil shown on the main form.

Link the main form and subform using PupID
No repeated name or VBA is needed: The form link supplies PupID for new subform records. Keep the student's name in Pupils and retrieve it through the main form or a query.
Free Microsoft Office alternative

Work with Office documents alongside your Access database

WPS Office is a free, lightweight alternative for everyday documents, spreadsheets, and presentations. Its familiar interface and Microsoft Office format compatibility make it easy to move those files between suites. It does not replace or repair an Access database.

Review pupil lists and related data exported from Access in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX, Word DOCX, and PowerPoint PPTX filesUse a familiar interface for everyday Office tasksWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

How does Access fill PupID in a new subform record?

When the subform control's Link Master Fields and Link Child Fields are both set to PupID, Access uses the current main-form value for new related records.

Why does the combo box show a name but store a number?

The combo box's Bound Column property determines which column is saved. Set Bound Column to 1 for PupID and hide that column with Column Widths while displaying the name in the second column.

Do I need to store the student's name in the Data table?

No. Store PupID as the foreign key and use a query that joins Data.PupID to Pupils.PupID when you need to display the student's name.

Can I display the selected name in a separate text box?

Yes. Add an unbound text box and set its Control Source to =cboPupID.Column(1), assuming the combo box is named cboPupID and the name is in its second column.