Views

Histats

Vitrine

VBA Access Basic - Abrindo um banco de dados no modo READ ONLY - Opening a Database in Read-Only Mode

Abrindo um banco de dados no modo READ ONLY.

Segue:

Sub Open_ReadOnly()
   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 .Mode = adModeRead
      Let .ConnectionString = "Data Source=" & strDb

      .Open
   End With

   Debug.Print "O banco de dados foi aberto como acesso read-only."

   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, Read-Only Mode,


✔ VBA Brazil®

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