10.1 Properly Secure Your Database

13.3 Change the Text Displayed with a Navigation Control

13.3.1 Problem

The DAP designer provides a recordset label in the navigation section of the page that includes record counts, the location of the current set within the total, and some text. You want to change the text displayed in the navigation section to something else. You can see the name of the table or query that's being navigated, but you don't know how to change the way the record counts are displayed.

13.3.2 Solution

Don't let the InnerText property fool you. The recordset label control also includes a RecordsetLabel property that controls how the record count is displayed. You'll need to use its special syntax, though, to get the exact display you want.

We've started with a simple page, shown in Figure 13-6 with its default recordset label. By default, a tabular page's recordset label shows the table name, number of records, and range of records currently displayed.

Figure 13-6. A page with its default recordset label

figs/acb_1306.gif

We'd like to change the page so that the recordset label looks like the one shown in Figure 13-7.

Figure 13-7. Use the RecordsetLabel property to change the format of record counts

figs/acb_1307.gif

To change the default recordset label, follow these steps:

  1. Open the page you want to change in design view.

  2. Select the recordset label. If you're using the mouse to select the control, you'll need to click twice: the first click selects the navigation control and the second click selects the recordset label.

  3. Display the properties sheet for the recordset label. Select the Data page to see the RecordsetLabel property.

  4. Notice the default value for the property. In our example, it looks like this:

    Customers |0 of |2;Customers |0-|1 of |2

    The format has two portions, separated by a semicolon. The first portion determines what the label will look like when only one record is displayed on the page; the second portion determines what the label will look like if more than one record is displayed on the page.

    Within each portion, the pipes followed by a 0, 1, or 2 are placeholders for the different record counts:

    • |0 represents the number of the current record or of the first record in the displayed group.

    • |1 represents the number of the last record in the displayed group.

    • |2 represents the total number of records in the entire recordset.

  5. Change the RecordsetLabel property to look like this:

    |2 Customers found. Viewing |0.;|2 Customers found. Viewing |0-|1.
  6. Switch to page view. The recordset label should now look like the one shown in Figure 13-7.

  7. If you're using our sample data for your page and displaying 10 records at a time, move to the last record. Because only one record is shown on the last page, the recordset label will use the first portion of the RecordsetLabel property's value to define the label's text, as shown in Figure 13-8. In fact, the first portion of the RecordsetLabel property is used both for pages where the DataPageSize property is 1 and for multirecord pages that show a single record under some circumstances.

    Figure 13-8. The recordset label when only one record is displayed

    figs/acb_1308.gif



Access Cookbook
Access Data Analysis Cookbook (Cookbooks)
ISBN: 0596101228
EAN: 2147483647
Year: 2005
Pages: 174

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net