HOWTO: Open Secured Microsoft Access Database In ADO 2.0 Through

ID: Q191754

The information in this article applies to:

SUMMARY

The new native OLE DB provider for Microsoft Access databases that ships with the Microsoft Data Access Components (MDAC) 2.0 components allows 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 three following syntaxes:

   Dim MyConn As New ADODB.Connection

   MyConn.Provider = "Microsoft.Jet.OLEDB.3.51"
   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.3.51"
   MyConn.Open ConnectionString:=strConn

   -or-

   Dim MyConn As New ADODB.Connection
   Dim strConn As String

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


If you are opening a database that uses Jet security, you can use any one of the three following syntaxes:

   Dim MyConn As New ADODB.Connection

   MyConn.Provider = "Microsoft.Jet.OLEDB.3.51"
   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.3.51"
   MyConn.Open ConnectionString:=strConn, _
               UserID:="Admin", Password:="MyPwd"

   -or-

   Dim MyConn As New ADODB.Connection
   Dim strConn As String

   strConn = "Provider=Microsoft.Jet.OLEDB.3.51;"
             "Data Source=C:\...\JetSecurity.MDB;" & _
             "Jet OLEDB:System database=C:\...\System.MDW"
   MyConn.Open ConnectionString:=strConn, _
               UserID:="Admin", Password:="MyPwd"


REFERENCES

(c) Microsoft Corporation 1998. All Rights Reserved. Contributions by David Sceppa, Microsoft Corporation

Additional query words: kbADO200 kbVBp500 kbVBp600 kbOLEDB200

Version           : WINDOWS:1.0,2.0,5.0,6.0
Platform          : WINDOWS
Issue type        : kbhowto

Last Reviewed: August 25, 1998