As we saw earlier, we have a form called frmDepartmentsAndFaculty that shows each department and the faculty assigned to it. We also have a report, rptDepartmentsWithFaculty, that shows the same information. It's helpful to have both, as one can be used to enter data, and the other can be used to create a snapshot of the data at a certain point of time.
However, we want to make it easier to move from the form to the report. We can add a button on our form to launch the report. In Access, this is called a command button. Let's create a command button on the form that will allow us to view and print the entire Departments with Faculty report.
Step1. To open the form directly into Design View, in the Navigation pane,
Click Design View
Step2. To select the command button tool, in the Controls group,
Step3. To add the command button, in the bottom of the form, just above Form Footer,
Click to place the button
Step4. To set the category, in Categories list,
Click Report Operations
Step5. To set the button action to open the report preview, in the Actions list,
Click Preview Report
Step6. To move to the next screen in the wizard,
Step7. To select the report we want and move to the next screen,
Step8. To add text to the button,
Press & Drag the default text of Preview Report,
type: Run Report
Step9. To name the button and finish creating it, type:
Testing the Command Button
To test the button, we need to be in Form view.
Step1. Switch back to Form view.
Step2. To launch the report in Print Preview mode, at the bottom of the form,
Click the Run Report button
Step3. Close the report.
Step4. To save the form, type:
Step5. Close the form and any other open Access objects.