Aqui está ela que está em um módulo:
Option Explicit
Global Conexao As ADODB.Connection
Global Rs As ADODB.Recordset
Global sSql As String
Public Function AbreBanco(ByVal sSql As String) As Boolean
Dim strArquivo As String
Dim strLocal As String
Dim ConectaAccess As String
Set Conexao = New ADODB.Connection
Set Rs = New ADODB.Recordset
Set Rs = CreateObject("ADODB.Recordset")
strArquivo = "D:andreacadastro de cdscad_cds.mdb"
strLocal = App.Path
Set Conexao = CreateObject("ADODB.Connection")
'ConectaAccess = "Driver={Microsoft Access Driver (*.mdb)};" & _
' "Dbq=" & strArquivo & ";" & _
' "DefaultDir=" & strLocal & ";" & _
' "Uid=;Pwd=;"
ConectaAccess = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strArquivo & ";" & _
"User ID=;" & _
"Password="
Conexao.Open ConectaAccess
Rs.Open sSql, Conexao, adOpenKeyset, adLockOptimistic
AbreBanco = True
End Function
Andrea Dahmer