|Figure 1: Dialog Form to collect the Amount Parameter.|
|Figure 2: tblOrders.|
- Select the command button on the form design grid, and click the PROPERTY SHEET icon (located in the TOOLS group of the DESIGN ribbon).
- When the PROPERTY SHEET opens, click the EVENT TAB.
- Then select the ON CLICK event by clicking into that particular cell of the grid.
- A three dot symbol appears at the right edge of the cell. Click it and select CODE BUILDER from the CHOOSE BUILDER dialog box which has opened.
- Then click the OK button and the VBA editor opens.
|Figure 3: The On Click Event on |
the PROPERTIES SHEET.
- Select tblOrders in the Navigation Pane. It will highlight in orange.
- Then select the CREATE ribbon , and click the REPORT icon (located in the REPORTS GROUP).
|Figure 4: Report Design.|
- Click the Square Box in the top right hand corner of the Report Design Grid. This ensures we are going to be working the properties of the actual Form (rather than one of its controls).
- Click on the PROPERTY SHEET icon (located in the TOOLS group of the DESIGN ribbon) whilst the Report is open in Design View.
- Click the DATA TAB of the pane.
- Make sure the SELECTION TYPE is set to REPORT. This should be the case if you carried out step 1 successfully. Otherwise just change the selection to Form in the drop down list.
- Enter the following into the FILTER property cell: Total >= forms![frmParameter]![txtAmount] . This has the effect of filtering out report records where the amount value in the Total field is greater or equal to that entered by the user in the Dialog Form's textbox.
- Then set the FILTER ON LOAD PROPERTY to YES. This ensures the filter is applied when the forms loads.
- Save the Report as rptOrdersFiltered.
- Close the Report
|Figure 5: The Form's Filter Properties. Note the reference to the textbox|
on our Dialog Form in the FILTER property cell.
|Figure 6: Report Results filtered for amounts greater than or equal to £50,000.|