Print the first few characters of a value as a group header in a report or data access page

Print the first few characters of a value as a group header in a report or data access page

  1. Open the report in Design view, or the data access page in Design view.

  2. Click Sorting And Grouping on the toolbar, and make sure that the properties in the Sorting And Grouping box are set as follows:
    Property Setting Applies to
    Field/Expression (Select a field or type an expression) Reports
    GroupRecordSource (Set when you click Promote or Group By Table on the toolbar) Data access pages
    GroupHeader Yes Reports, pages
    GroupFooter Yes or No Reports, pages
    GroupOn Prefix Characters Reports, pages
    GroupInterval (Type the number of characters) Reports, pages
    KeepTogether (Select an option) Reports
    DefaultSort (Type the name(s) of the field(s) you want to sort on.) Data access pages
  3. Add a calculated text box to the group header.

    Note   On a data access page, you can use a bound HTML control instead of a text box.

  4. To display the property sheet, make sure that the text box or bound HTML control is selected, and then click Properties on the toolbar.

  5. In the ControlSource property box, type the expression (by using the Left or Right function) that will extract the appropriate characters.

    For example, if you're tracking office equipment and furniture, and the asset number includes an alphabetic code for distinguishing one type of asset from another (for example, FR100 for furniture), you could use an expression similar to the ones in the following table.

    This expression Returns
    =Left([AssetCode], 2) FR
    =Right([AssetCode], 3) 100

    Tip   In a form or report in a Microsoft Access database (.mdb), you can click the Build button to use the Expression Builder to create the expression.

Notes