Online Book Reader

Home Category

Access Cookbook - Ken Getz [281]

By Root 1839 0


MSTheme-Label msoNavFirst

Change the ClassName properties for each navigation control to include the class name for its function. Table 13-1 lists all the classes for navigation controls.

Table 13-1. Navigation functions and their class names

Function

Class name

First

msoNavFirst

Previous

msoNavPrevious

Next

msoNavNext

Last

msoNavLast

New

msoNavAddNew

Delete

msoNavDelete

Save

msoNavSave

Undo

msoNavUndo

Sort Ascending

msoNavSortAsc

Sort Descending

msoNavSortDesc

Filter by Selection

msoNavFilter

Filter Toggle

msoNavToggleFilter

Help

msoNavHelp

Recordset Label

msoNavRecordsetLabel

Run the page and test the navigation labels. You should notice that although the labels function properly, the cursor turns into an I-beam when you move the mouse over it. You can fix this by changing the Cursor property of each label, as described in Steps 8-9.

Return to design view. Select all of the navigation labels and view the properties sheet.

Change the Cursor property to hand for the labels.

Run the page again. Now the cursor should change to a pointing finger when you move the mouse over one of the labels.

13.3. Change the Text Displayed with a Navigation Control


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.

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

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

To change the default recordset label, follow these steps (or open 13-03.mdb to see the completed sample):

Open the page you want to change in design view.

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.

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

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.

Change the RecordsetLabel property to look like this:

|2 Customers found. Viewing |0.;|2 Customers found. Viewing |0-|1.

Switch to page view. The recordset label should now look like the one shown in Figure 13-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

Return Main Page Previous Page Next Page

®Online Book Reader