dim bDados as new Adodb.connection
Private sub Grava()
Bdados.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & app.path & "MeuBancodeDados.MDB;"
dim wRs_Tabela as new Adodb.Recordset
If Not AbreTab(wRs_tabela, "Update Cadastro set valor=60.00", 1) Then exit sub
If Not AbreTab(wRs_tabela, "Update Lancamentos set valor=60.00", 1) Then exit sub
End Sub
Public Function AbreTab(wRs_Tabela As ADODB.Recordset, Consulta As String, TipoAbertura As Byte) As Boolean
'flag de abertura
Dim resultado As Boolean
Dim msg As String 'mensagem de erro
resultado = False
On Error Resume Next
wRs_Tabela.Close
Set wRs_Tabela = Nothing
On Error GoTo wRs_TabelaErro
If Consulta = "" Then Consulta = "Select * from " & Nome_wRs_Tabela
Set wRs_Tabela = New ADODB.Recordset
If TipoAbertura = 0 Then
wRs_Tabela.Open Consulta, Bdados, adOpenForwardOnly, adLockReadOnly
Else
wRs_Tabela.Open Consulta, Bdados, adOpenKeyset, adLockPessimistic, adCmdText
End If
resultado = True
AbreTab = resultado
'fecha tratamento de erro
On Error GoTo 0
Exit Function
'tratamento de erro de wRs_Tabelas
wRs_TabelaErro:
' Mense2 7
MsgBox Err.Description
resultado = False
AbreTab = resultado
Exit Function
End Function