Microsoft Knowledge Base Email Alertz

(191754) - The native OLE DB provider for Microsoft Access databases that ships with Microsoft Data Access Components (MDAC) version 2.0 or later enables you to open a secured Microsoft Access database.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 191754 - Last Review: July 10, 2006 - Revision: 3.1

How to open a secured Access database in ADO through OLE DB

This article was previously published under Q191754

SUMMARY

The native OLE DB provider for Microsoft Access databases that ships with Microsoft Data Access Components (MDAC) version 2.0 or later enables you to open a secured Microsoft Access database.

MORE INFORMATION

If you are opening a password-protected database, you can use any one of the following three syntaxes:
   Dim MyConn As New ADODB.Connection

   MyConn.Provider = "Microsoft.Jet.OLEDB.4.0"
   MyConn.Properties("Data Source") = "C:\...\JetPassword.MDB"
   MyConn.Properties("Jet OLEDB:Database Password") = "MyPwd"
   MyConn.Open
				
-or-
   Dim MyConn As New ADODB.Connection
   Dim strConn As String

   strConn = "Data Source=C:\...\JetPassword.MDB;" & _
             "Jet OLEDB:Database Password=MyPwd"
   MyConn.Provider = "Microsoft.Jet.OLEDB.4.0"
   MyConn.Open strConn
-or-
   Dim MyConn As New ADODB.Connection
   Dim strConn As String

   strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
             "Data Source=C:\...\JetPassword.MDB;" & _
             "Jet OLEDB:Database Password=MyPwd"
   MyConn.Open strConn

If you are opening a database that uses Jet security, you can use any one of the following three syntaxes:
   Dim MyConn As New ADODB.Connection

   MyConn.Provider = "Microsoft.Jet.OLEDB.4.0"
   MyConn.Properties("Data Source") = "C:\...\JetSecurity.MDB"
   MyConn.Properties("Jet OLEDB:System database") = "C:\...\System.MDW"
   MyConn.Open UserID:="Admin", Password:="MyPwd"
-or-
   Dim MyConn As New ADODB.Connection
   Dim strConn As String

   strConn = "Data Source=C:\...\JetSecurity.MDB;" & _
             "Jet OLEDB:System database=C:\...\System.MDW"
   MyConn.Provider = "Microsoft.Jet.OLEDB.4.0"
   MyConn.Open ConnectionString:=strConn, _
               UserID:="Admin", Password:="MyPwd"
				
-or-
   Dim MyConn As New ADODB.Connection
   Dim strConn As String

   strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
             "Data Source=C:\...\JetSecurity.MDB;" & _
             "Jet OLEDB:System database=C:\...\System.MDW"
   MyConn.Open ConnectionString:=strConn, _
               UserID:="Admin", Password:="MyPwd"
NOTE: Jet 3.51 OLEDB provider is designed to open Access 97 databases only. Jet 4.0 OLEDB provider is designed to open Access 2000 or Access 97 databases.

If you must use the Jet 3.51 Provider in the above examples, change the provider name to "Microsoft.Jet.OLEDB.3.51."

We recommend that you take additional steps to incorporate encryption on the network. For example, you can use the Secure Sockets Layer (SSL) when you run the application on a network.

Microsoft Data Access Components (MDAC) version 2.6 and later do not contain the following Jet components:

APPLIES TO
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft ActiveX Data Objects 2.0
  • Microsoft ActiveX Data Objects 2.1 Service Pack 2
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft OLE DB Provider for Jet 1.0
Keywords: 
kbhowto kbjet kbmdacnosweep KB191754
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate