HOWTO: Open Secured Access Database In ADO 2.0 Through OLE DB
ID: Q191754
|
The information in this article applies to:
-
Microsoft Visual Basic Professional and Enterprise Editions for Windows, versions 5.0, 6.0
-
ActiveX Data Objects (ADO), versions 2.0, 2.1 SP2
-
Microsoft OLE DB Provider for Jet, version 1.0
SUMMARY
The native OLE DB provider for Microsoft Access databases that ships
with the Microsoft Data Access Components (MDAC) 2.0 or later 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"
NOTE: Jet 3.51 OLEDB provider is designed to open Access 97 databases only
and Jet 4.0 OLEDB provider is designed to open Access 2000 or Access 97 databases.
If you need to use the Jet 4.0 provider in the above examples, just change the
provider name to "Microsoft.Jet.OLEDB.4.0."
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by David Sceppa, Microsoft Corporation
Additional query words:
Keywords : kbADO kbOLEDB200 kbVBp500 kbVBp600 kbGrpVBDB kbGrpMDAC kbMDAC210SP2
Version : WINDOWS:1.0,2.0,2.1 SP2,5.0,6.0
Platform : WINDOWS
Issue type : kbhowto