Access07: Hire Co : HR - Multi-table form to report

From virtualMV2015wiki
Jump to: navigation, search
 Home  MS Access <

Linking to a report

A useful feature of Access is the ability to place a button on a form to link to another form or report.

In this task I will add a button to link to the timesheet report.

1. Open the Staff Timesheet report (rptStaffTS) in design view

2. Making sure the wizard button is on, click the Button (Form Control) button and drag onto the form

3. Now follow the wizard...

  • Select Report Operations > Preview Report, [Next]
  • Select rptStaffTS (created earlier)
  • Change the icon (if you wish - cick the show All Pictures box) and the text to read Staff x Timesheet Report, [Next]
  • Change the button name to cmdRptStaffxTSPreview

4. And thats all...

Linking to a report that only prints for the displayed record

With the Staff Timesheet form open (frmStaffTS)

1. Copy the Staff x TimeSheet report to rptStaffTS_Single

What we are going to do is find out what the StaffID on frmStaffTS is called, and to do this we are going to use the expression builder.

2. Open rptStaffTS_Single

3. In design view, right click on the form properties button (top left) and select properties

4. Choose Build Event ... > Expression Builder

5. Navigate to the frmStaffTS form (Forms > Loaded Forms > frmStaffTS) and find StfID in the center column, then double click. This should put the expression you want in your query into the text area.

6. Highlight the expression ( Forms![frmStaffTS]![StfID] ) and copy to the clip board ([Ctrl]+[C])

Acc07 Hire HR rptStaffTS10.png

7. In report's design view, right click on the form properties button (top left) and select properties

3. In the Record Source Property, click on the Change the control [...]

4. Change the Query so that StfID = the form stfID on frmStaffTS

Acc07 Hire HR rptStaffTS10.png

5. Save

6. Now add the link button to frmStaffTS

Icon References.png References

Access07: Hire Co : HR - Multi-table form to report. (2019). In virtualMV's ( Michael Verhaart ) wiki. Retrieved May 21, 2019, from    (zotero)