Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
ACC2000: How to Open a Database from Read-Only Media with Microsoft Jet 4.0 and ADO
Article ID: 275484 - View products that this article applies to.
This article was previously published under Q275484
Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access database (.mdb).
When you want to open a database read-only with the ActiveX Data Object (ADO) and the Jet 4.0 provider, the Connection object's Mode property must be set to adShareDenyWrite. This article demonstrates how to do this.
The following example demonstrates how to set the Connection object's Mode property to adShareDenyWrite, which allows the database to be opened from read-only media such as a CD-ROM drive. It also uses the OpenSchema method to open the table's schema, to loop through, and to print all user-defined tables.
This example opens NWIND.MDB, which is located on your Office 2000 or Access 2000 CD.
NOTE: If your CD-ROM drive is not drive D, change the drive letter in the code to the correct one.