16. Click OK to close the Choose Data Source dialog box.
17. In the Query Wizard, or Microsoft Query, create your query, then complete the PivotTable and PivotChart Wizard.
How It Works
To open an Access file that has user-level security, you need to use the workgroup file for that database. This file, with an .mdw extension, is created when user-level security is added to the database, and contains the valid user ID and password information. The previous technique enters the workgroup file information into the DNS file, and that DNS file is used as the data source for the database.
8.4. Protection: Preventing Changes to a Pivot Table
Problem
You want to prevent users from making any changes to the pivot table. They should be able to view the pivot table, but not change the selected items, type over any of the field names, or rearrange the layout. However, you want users to be able to make changes to data and formulas in other areas of the worksheet.
Solution
If you protect the worksheet without enabling pivot table use, or if you share the workbook, users won’t be able to modify the pivot table.
Protecting the Worksheet
When protecting a worksheet, prepare the sheet first by unlocking cells where changes can be made. Then, turn on the worksheet protection.
To prepare the sheet, follow these steps:
1. Select any cells in which users will be allowed to make changes.
2. Choose Format ➤Cells.
3. On the Protection tab, remove the checkmark from Locked. If some selected cells are currently locked, and others are unlocked, the check box will contain a gray checkmark. Click once in the check box to add a black checkmark, then click again to clear the check box (see Figure 8-3).
Figure 8-4. Select items to enable on a protected worksheet.
4. Click OK to close the Format Cells dialog box.
Now, to protect the worksheet, do the following:
1. Choose Tools ➤Protection ➤Protect Sheet.
2. If desired, enter a password. If you don’t enter a password, the worksheet will be protected, but can be unprotected simply by choosing Tools ➤Protection ➤ Unprotect Sheet.
3. Remove the checkmark from Use PivotTable reports, and check the items that you want enabled on the protected worksheet (see Figure 8-4).
8 . 4 ■ P R OT E C T I O N : P R E V E N T I N G C H A N G E S TO A P I V OT TA B L E 186
4. Click OK and confirm the password, if one was entered.
Figure 8-3. The Locked check box contains a gray checkmark if some selected cells are currently locked and others are unlocked.
8 . 4 ■ P R OT E C T I O N : P R E V E N T I N G C H A N G E S TO A P I V OT TA B L E 187
Sharing the Workbook
Instead of protecting the worksheet, you can share the workbook, which prevents users from changing the pivot table. It also prohibits other activities in the workbook.
1. Choose Tools ➤Share Workbook.
2. On the Editing tab, add a checkmark to Allow changes by more than one user at the same time. This also allows workbook merging.
3. Click OK, and click OK again to save the workbook if a confirmation message appears.
How It Works
Here’s how the two methods prevent changes to the pivot table.
Protecting a Worksheet with Pivot Table Use Not Allowed
If the worksheet is protected, and Use PivotTable reports was not selected in the Allow all users of the worksheet to list, users won’t be able to make any changes to the pivot tables on the worksheet. For example, they won’t be able to open the dropdown lists on the pivot field buttons, move fields, remove fields, or add fields. The pivot field list will be hidden.
You can create a PivotChart report from a PivotTable report on the protected sheet, but you won’t be able to change the PivotChart layout or select an item from its field lists.
You will be able to change the PivotChart formatting, chart type, and chart options.
Other pivot tables, based on the pivot tables on a protected sheet, will have some features, such as Refresh Data, disabled.
■ Tip If you use worksheet protection to disable the pivot table, many other features of the worksheet will also be disabled, such as AutoSum, Spelling, Subtotals, and creating or refreshing a pivot table. If these features are required on the worksheet, you may prefer to use programming to protect the pivot table, while leaving the worksheet unprotected.
Sharing a Workbook
If you share a workbook, in order to disable the pivot table, many other features of the workbook will also be disabled, such as creating charts, adding conditional formatting, and deleting worksheets. If these features are required in the workbook, you may prefer to use programming to protect the pivot table instead of sharing the workbook.
8 . 4 ■ P R OT E C T I O N : P R E V E N T I N G C H A N G E S TO A P I V OT TA B L E 188
The following features are disabled in a shared workbook:
• Creating or changing PivotTable reports
• Creating or changing charts or PivotChart reports
• Creating lists
• Creating data tables
• Inserting or deleting a range of cells
• Deleting worksheets
• Writing, recording, changing, viewing, or assigning macros
• Merging cells or splitting merged cells
• Adding or changing conditional formats
• Adding or changing data validation
• Assigning, changing, or removing passwords
• Protecting worksheets or the workbook
• Creating, changing, or viewing scenarios
• Grouping or outlining data
• Inserting automatic subtotals
• Working with XML data
• Using a data form to add new data
• Adding or changing Excel 4 dialog sheets
• Changing or deleting array formulas
• Inserting or changing pictures or other objects
• Inserting or changing hyperlinks
• Using drawing tools