Views

Histats

Vitrine

VBA Access - Abrindo um Banco de Dados protegido com Senha - Opening a Password-Protected Database

Abrindo um Banco de Dados protegido com Senha.

Segue:

Sub Open_WithDbPassword()
   Dim conn As ADODB.Connection
   Dim strDb As String

   On Error GoTo ErrorHandler

   Let strDb = CurrentProject.Path & "\Bernardess\mydb.mdb"
   Set conn = New ADODB.Connection

   With conn
      Let .Provider = "Microsoft.Jet.OLEDB.4.0;"
      Let .ConnectionString = "Data Source=" & strDb & ";" & _
           "Jet OLEDB:Database Password=secret;"
      .Open
   End With

   Debug.Print "Banco de dados protegido está aberto"

   conn.Close

   Set conn = Nothing

   Debug.Print "Database was closed."
   Exit Sub

ErrorHandler:
   MsgBox Err.Number & ": " & Err.Description
End Sub

Tags: VBA, Access, connect, SQL, database,  Connecting, Server, Data Source, Opening, Password, Protected, senha, protegido, 


✔ VBA Brazil®

✔ VBA Brazil®
brazilsalesforceeffectiveness@gmail.com
Related Posts Plugin for WordPress, Blogger...
diHITT - Notícias