If you don’t find the stock you’re using, you can set up a custom template. Click the Customize button on the first dialog box, which will list the custom templates. This list will be empty, initially. Click the New button to define a new template. The New Label dialog box shown in Figure 12-44.
CHAPTER 12 n REPORTS
Figure 12-44. Defining a new label stock template
There are nine measurements that you’ll need to enter to define the label stock. Select the units, whether English or Metric, and then type the values directly on the form. The Label Name and Dimensions fields at the top of the dialog box are for reference purposes, so you can identify this template when you want to use it later. The Dimensions field is filled in automatically as you supply those measurements.
Once the template has been set up, you can use it again later. In the first dialog box of the Label Wizard, select the “Show custom label sizes” check box and your custom templates will be listed in the dialog box.
Formatting the Labels
Once you have selected the label template you’re ready to format the text that will appear on the label.
You will first define the font that should be used. Then you’ll specify the text for each line and finally define the sort criteria.
1. In the second dialog box, shown in Figure 12-45, use all the default values.
CHAPTER 12 n REPORTS
Figure 12-45. Specifying the font attributes
2. In the third dialog box, you’ll specify what text should go on each line. The right side of the dialog box contains a prototype of the label. Access calculates the number of lines that will fit based on the label dimensions and the font that was chosen. The Label Wizard supports a maximum of eight lines, but it could be fewer than that. In this case only six lines can be used. You format each line separately. When you select one of the lines on the right side it will be highlighted. On each line you can type static text and/or add one or more fields from the list of available fields. For the first line, enter the static text Pro Access 2010 – Library.
3. For the second and third lines, double-click the Title and Author fields, respectively.
4. The fourth line will contain both static text and data-bound fields. Enter Type:
and then double-click the MediaCode field. Then type Shelf as: and select the CategoryCode field.
5. Leave the fifth blank.
6. For the sixth line, add the InventoryItemID. The format should look like Figure 12-46.
CHAPTER 12 n REPORTS
Figure 12-46. Formatting the label
7. In the fourth dialog box you’ll specify the sort order. Enter the sort fields as MediaCode, CategoryCode, and Author as shown in Figure 12-47. This probably matches how they are grouped on the self.
Figure 12-47. Specifying the sort order
8. In the final dialog box, enter the name as InventoryLabels, as shown in Figure 12-48.
CHAPTER 12 n REPORTS
Figure 12-48. Entering the report name
n Note An advanced application might even format the InventoryItemID value as a barcode to allow this to be scanned during the checkout process. Barcode support is not provided natively in Access so you would need to use a third-party ActiveX control.
Modifying the Color Scheme
The Label Wizard will then create the report and display it using the Print Preview View. You’ll need to fix the color scheme for this report.
9. Click the Close Print Preview button in the ribbon. This will close that window and open the InventoryLabels report using the Design View.
10. In the Property Sheet, select the Detail object and set the Back Color to the standard White color.
11. Press Ctrl-A to select all the controls. From the Format tab of the Property Sheet, set the Back Color property to White.
12. Save the changes to the InventoryLabels report and switch to the Print Preview View.
The final report should look like Figure 12-49.
CHAPTER 12 n REPORTS
Figure 12-49. The final InventoryLabels report
Auto-Generating a DailyLoans Report
For the final project in this chapter, let's say you’ve been asked to generate a daily report that lists the items that were loaned during that day. The users want this to run every day automatically at the same time each day, after the library has closed. To avoid any printer issues (like someone forgetting to leave paper in the printer) they’ve asked you to save the report as a PDF file. Then they can view or print it whenever they want.
So, you’ll create a DailyLoans report that will list the items that were loaned out today. This will be a copy of the AllLoans report that you created earlier, except you’ll add a filter to limit the result to the items checked out today. Then you’ll implement a macro that will open this report and save it as a PDF file. Finally you’ll create a shortcut to call this macro and use the Windows Task Scheduler to generate this report at the same time every day.
Creating the DailyLoans Report
This is a pretty easy step. You’ll make a copy of the AllLoans report, add a filter and change the report title.
1. Open the AllLoans report using the Design View. From the File tab, click the
“Save Object As” button. In the Save As dialog box, enter the name DailyLoans, as shown in Figure 12-50.
Figure 12-50. Save a copy of the AllLoans report