by NBS Solutions (5 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 27th May 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Open a password protected Access data file using ADO code
API Declarations
Dim cn As New ADODB.Connection, strCNString As String
strCNString = "Data Source=" & App.Path & "\BB.mdb"
cn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
cn.ConnectionString = strCNString
cn.Properties("Jet OLEDB:Database Password") = "aaa"
cn.Open
MsgBox "Data File is now opened"
cn.Close
End Sub
Private Sub OptionA()
cn.Open "Provider=Microsoft Jet 4.0 OLE DB Provider;Data Source=" & App.Path & "\BB.mdb" & ";Jet " _
& "OLEDB:Database Password=aaa"
MsgBox "Data File is now opened"
cn.Close
End Sub