Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Assuntos que não estiverem relacionados as categorias acima. Se não souber em qual categoria sua mensagem se encaixa, envie aqui.
#58257
Estou utilizando o código abaixo, mas a tabela do access não recebe os valores do formulário criado no excel.
Estou fazendo o teste com esse campo: .Fields("NOME") = Txtnome , o campo txtnome do formulalrio não é carregado no access.

Sub cmdAdd_Click()

Dim cnn As ADODB.Connection 'dim the ADO collection class
Dim rst As ADODB.Recordset 'dim the ADO recordset class
Dim dbPath
Dim x As Long, i As Long

On Error GoTo errHandler:

dbPath = ThisWorkbook.Path & "\" & "Projeto_Central.accdb;"
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbPath & "Jet oledb:DATABASE PASSWORD=123456;"

Set rst = New ADODB.Recordset

rst.Open Source:="Cadastro", ActiveConnection:=cnn, _
CursorType:=adOpenDynamic, LockType:=adLockOptimistic, _
Options:=adCmdTable


With rst

.AddNew
.Fields("NOME") = Txtnome
.Update

End With

rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
'commuinicate with the user
MsgBox " The data has been successfully sent to the access database"
On Error GoTo 0
Exit Sub
errHandler:
Set rst = Nothing
Set cnn = Nothing
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdAdd"
End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord