Access.2007.VBA.Bibl..

(John Hannent) #1
See Chapter 7 for a more flexible way of specifying a Templates folder and a Documents
folder.

After the code deletes the archived records — first the ones in tblOrderDetails (the “many” table)
and then those in tblOrders (the “one” table) — a final message appears, as shown in Figure 3.9.

FIGURE 3.9
A final informative message stating that the archived database records have been cleared.

A worksheet filled with archived data is shown in Figure 3.10.

FIGURE 3.10
A worksheet filled with archived Access data.

Saving the newly created worksheet with the xlWorkbookDefaultvalue for the FileFormat
argument saves it as a standard Excel worksheet. If you need to save the worksheet in another for-
mat, perhaps for use by someone running an older version of Excel, you can use one of the other
values in the XlFileFormatenum, which are shown in the Object Browser in Figure 3.11. The
xlExcel9795named constant will create a worksheet in a format usable by people running
Excel 95 or 97. (The worksheet format choices available in VBA code are much more numerous
than those available in the interface, as shown in Figure 3.12.)

NOTENOTE


Part I The Office Components and What They Do Best

Free download pdf