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

This article was previously published under Q191754
This article has been archived. It is offered "as is" and will no longer be updated.
SUMMARY
The native OLE DB provider for Microsoft Access databases that shipswith 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 ofthe 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 oneof 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: 12/05/2015 09:10:36 - Revision: 3.1

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

  • kbnosurvey kbarchive kbhowto kbjet kbmdacnosweep KB191754
Feedback