Locked lesson.
About this lesson
Continue setting up the subform and protect it from editing.
Exercise files
Download this lesson’s related exercise files.
8.02 setting-up-subforms---part-2 - Exercise.docx43.6 KB 8.02 setting-up-subforms---part-2 - Exercise solution.docx
94.9 KB TechGurusTicketing21.accdb
876 KB TechGurusTicketing21 - Complete.accdb
904 KB
Quick reference
Setting Up Subforms - Part 2
Add the subform to the main form and adjust the subform properties.
When to use
Add a subform to a form to provide related data from a one-to-many relationship. This allows you to present many related records within a record.
Instructions
Creating the Subform
- From the Create tab, in the Forms group, click Form Design.
- From the Form Design tab, in the Tools group, click Property Sheet.
- Select Form from the drop-down.
- In the Record Source, select ‘tblRelatedTickets’.
- From the Form Design tab, in the Tools group, click Add Existing Fields.
- Select the fields 'RelatedTicketNumber', 'DateLogged', 'Charge' and 'SLA' from ‘tblRelatedTickets’ and add them to the form.
- Arrange the fields so they are in one row.
- Drag the bottom of the form up to remove the extra space.
- Right-click on the tab and switch to Form View.
- Check the fields are the correct size.
- Select each field and check the Name, Label, and Caption in the Property Sheet.
- Rename where required.
- Change Allow Datasheet View to Yes.
- Change the Default View to Continuous Forms.
- Name the form ‘frmRelatedTickets'.
Adding the Subform to the Ticket Maintenance Form
- Open ‘frmTicketMaintenance’.
- From the Form Design tab, in the Form Controls group, select the Subform/Subreport Control.
- Draw a subform box at the bottom of the form.
- From the Subform Wizard, select Use an existing form.
- Choose 'frmRelatedTickets' from the list.
- Click Next.
- Select Show tblRelatedTickets for each record in tblTicket using TicketNumber.
- Click Finish.
- Resize the subform.
- Switch to Form View to review.
- Save and Close.
Disable the Record Selector, Edits, and Deletions
We can change the subform properties to limit changes to the subform.
- From the Property Sheet change the following properties:
- Record Selectors: No
- Navigation Buttons: No
- Allow Additions: No
- Allow Deletions: No
- Allow Edits: No
- Review the changes in Form View.
Lesson notes are only available for subscribers.