Hello everyone first time here i'm starting to learn access and i'm having a problem with the SQL update function,
When I try to compare "CodigoRequisicao" which is a field of type auto incrementable (in a table I own) with "CodigoREQ" which is a integer type variable i get the error:
"Error 3464 Data type mismatch in criteria expression"
Thank you all for your attention
What can i do to solve this error?
Code:
Private Sub GerarRequisicao()
If Me.txt_oculto = "Existente" _
Then
Dim Comando As String
Dim DataSaida As Date
Dim CodigoREQ As Integer
DataSaida = Me.txt_DataSaidaRequisicao
CodigoREQ = Me.txt_CodigoRequisicao
Comando = "UPDATE tabela_requisicao SET DataSaidaRequisicao = '" & DataSaida & "'" & _
"WHERE CodigoRequisicao = '" & CodigoREQ & "'"
db.Execute (Comando)
''Error is above in the then ^^
Else
cmd = "INSERT INTO tabela_requisicao(DataSaidaRequisicao,DataRetornoRequisicao,LocalRequisicao,ResponsavelRequisicao)VALUES('" & Me.txt_DataSaidaRequisicao & "', '" & Me.txt_DataRetornoRequisicao & "', '" & Me.txt_LocalRequisicao & "', '" & Me.txt_ResponsavelRequisicao & "')"
db.Execute (cmd)
MsgBox ("Requisição criada com sucesso"), vbInformation + vbOKOnly
End If
End Sub
"WHERE CodigoRequisicao = '" & CodigoREQ & "'"
When I try to compare "CodigoRequisicao" which is a field of type auto incrementable (in a table I own) with "CodigoREQ" which is a integer type variable i get the error:
"Error 3464 Data type mismatch in criteria expression"
Thank you all for your attention
What can i do to solve this error?