![]() |
Forms & Reports:
|
![]() Did you want: Working with Databases: Access 2007, 2010, 2013, 2016 | ||||
|
![]() |
Access lets you display data that is related to records in a form or report by using a subform or subreport. The creation and management is much the same for both. A subform is a form that is embedded in a form or report, the main form/report. A subreport is a report that is inserted into another report, the main report. You cannot put a subreport onto a form. The form or report that contains a subform or subreport is called the parent. The subform or subreport is called the child.
Form with subform on tab page; Report with subreport in Detail
The illustration shows one subreport in the Report Header, which will appear only once, and another the Detail section, which will be different for each record. Nesting: You can nest up to 7 levels of subforms inside forms or subreports inside reports. "Nesting" means you have a main form that contains a subform, which itself contains a subform, which also contains a subform... for 7 levels deep. It's the same for reports. Having that many levels would certainly be unusual! Total number: There is no particular limit to how many separate subforms or subreports you can put into a form or report. |
![]() |
Project 4: Forms & Reports
| ||||
How to Create a Subform/Subreport
WizardIf you use the Subform/Subreport tool, a wizard opens with just 3 steps. The illustrations below are for a subform but the wizard is the same for a subreport. Only the title bar is different.
You cannot create a new query from inside the wizard. It must already exist.
If you chose to use an existing form or report, the wizard skips this
step.
What Does a Subform/Subreport Show?
The usual type of subform/subreport shows such related data, synchronized to the current record on the main form or report. Very useful!
A subform can use any view. Datasheet View or Form View are, of course,
the most common. You can even edit the data in the subform or add new
records. Sweet!
Subform as datasheet; Subform as form Linking Parent and Child
The field names are usually the same but can be different. The data types, however, must be the same or compatible. These are usually the fields that join the underlying tables, otherwise you cannot be sure that there is a unique choice. You can edit the Link properties yourself if Access loses track of the matching fields. Be careful to pick the right fields! If you are wrong, you will pull the wrong data and it may not change correctly when you change records on the main form/report! The subform/subreport will be blank if Access cannot connect the data. Conditions must be met for Access to automatically link the child and parent:
|
![]() |
~~ 1 Cor. 10:31 ...whatever you do, do it all for the glory of God. ~~ |