This guide contains over 200 code examples that show how to correctly use the Microsoft Jet database engine. To help you learn about these features and incorporate them into your applications, the companion CD-ROM contains an electronic version of each code example used in the printed guide.
The code examples are stored in the JetBook\Samples subfolder on the companion CD-ROM. All of the code examples for Microsoft Access 97 are stored as modules in a Microsoft Access database named JetSamples.mdb. All of the code examples for Visual Basic 5.0 and other applications that support VBA 5.0 are stored as modules (.bas files) that are referenced in a Visual Basic project named JetSamples.vbp. Both JetSamples.mdb and JetSamples.vbp use tables and queries in NorthwindTables.mdb, also located in the JetBook\Samples subfolder. Additionally, some of the code examples for Chapter 8, “Accessing External Data,” use sample data files in other formats, such as the Paradox sample data file, Author.db. These sample data files are located in subfolders in the JetBook\Samples folder and must be present in order for these code examples to work properly.
All of the code examples are designed to be executed from your hard disk. Use the Windows Explorer to copy the complete directory structure to the root directory of your C drive. Because files stored on a CD-ROM must have their read-only file attribute set, you may need to clear the read-only file attribute after copying the files. To make this process easier, you can run the function named RemoveReadOnlyAttr from the FileAttributes module in JetSamples.mdb, or from FileAttributes.bas. For more information about specific file names or additional requirements for the code examples in each chapter, see the introduction in that chapter.
To use the Visual Basic code modules referenced in JetSamples.vbp in Visual Basic 5.0, you can open JetSamples.vbp directly. To use these modules from a VBA 5.0 host application other than Microsoft Access 97, such as Microsoft Word 97, you must import the module(s) into the Visual Basic Editor. Additionally, you must set a reference to the Microsoft DAO 3.5 object library (see below).
Important Don’t copy and paste code examples from JetSamples.mdb into Visual Basic 5.0 or other VBA 5.0 host applications. Many code examples in JetSamples.mdb include code that uses Microsoft Access-specific Visual Basic keywords and techniques that will fail if run from other applications. The modules referenced in JetSamples.vbp are designed to run in Visual Basic 5.0 and other VBA 5.0 host applications.
Û To import a .bas file into the Visual Basic Editor
Û To set a reference to the Microsoft DAO 3.5 Object Library
Note The reference for the Microsoft DAO 3.5 object library is available only if you selected the Data Access Objects For Visual Basic option under the Data Access option when you ran the Setup program for Microsoft Access 97, Microsoft Excel 97, Microsoft Office 97, or Microsoft Office 97 Professional Edition. If the object library is not available, re-run the Setup program and select this option. The Data Access Objects For Visual Basic option is not available in the Setup program for the stand-alone versions of Microsoft PowerPoint 97 or Microsoft Word 97.