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

Article translations Article translations
Article ID: 191754 - View products that this article applies to.
This article was previously published under Q191754
Expand all | Collapse all

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:

Properties

Article ID: 191754 - Last Review: July 10, 2006 - Revision: 3.1
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

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com