Abrindo um Banco de Dados protegido com Senha.
Segue:
Sub Open_WithDbPassword()Dim conn As ADODB.ConnectionDim strDb As StringOn Error GoTo ErrorHandlerLet strDb = CurrentProject.Path & "\Bernardess\mydb.mdb"Set conn = New ADODB.ConnectionWith connLet .Provider = "Microsoft.Jet.OLEDB.4.0;"Let .ConnectionString = "Data Source=" & strDb & ";" & _"Jet OLEDB:Database Password=secret;".OpenEnd WithDebug.Print "Banco de dados protegido está aberto"conn.CloseSet conn = NothingDebug.Print "Database was closed."Exit SubErrorHandler:MsgBox Err.Number & ": " & Err.DescriptionEnd Sub
Tags: VBA, Access, connect, SQL, database, Connecting, Server, Data Source, Opening, Password, Protected, senha, protegido,
Nenhum comentário:
Postar um comentário