Group records by the first n characters in a text value on a data access page
Learn about grouping records by the first n (or prefix) characters.
- Open the data access page in Design view.
- Create a grouped data access page.
- Make sure there are two controls bound to the field you want to use to group by prefix characters.
- Make sure the control you want to use to group by prefix characters is selected.
- Click Promote on the toolbar.
Microsoft Access adds a group header that contains an expand control, and a record navigation section that contains a record navigation control Access moves the control you grouped on to the group header.
- Click Sorting And Grouping on the toolbar to display the Sorting And Grouping box.
- Click the group record source that you want to group by prefix characters.
- Set the following properties:
- Set GroupOn to Prefix Characters.
- Set GroupInterval to the number of characters you want to group on.
- Specify the default sort order for the other group levels on the page.
Note When you group on a control, Access creates an alias for the control by adding the prefix "GroupOf" to the control's name in the ControlSource property; for example, GroupOfProductName: ProductName. When you reference this control in an expression or in a property, you must use the alias.