NADIRONUNES 20/4/2012, 20:40
vou postar o codigo completo pois to querendo trasportar das consultas estoqe e estoqs pra tabela estoq e ta dando erro nestas linhas vermelhas e o erro e o seguinte;
tipo de dados incompativel na expressao de criterio
eu quero transportar tudo da consulta estoqs e da consulta estoqs
mas subtraindo o que esta na consulta estoqs.
Dim db As Database, db2 As Database, rs1 As DAO.Recordset, rs2 As DAO.Recordset
Dim rs3 As DAO.Recordset, rs4 As DAO.Recordset
If MsgBox("Confirma a venda?", vbYesNo + vbQuestion, "CONFIRMAR") = vbYes Then
Set db = CurrentDb
Set rs3 = db.OpenRecordset("select * FROM ESTOQE where DATA <= '" & Forms!RELATORIOS!D2 & "'")
Set rs4 = db.OpenRecordset("select * from ESTOQS where DATA <= '" & Forms!RELATORIOS!D2 & "'")
Set rs2 = db.OpenRecordset("select * from ESTOQ")
While (Not rs3)
Dim QUANTS
QUANTS = rs3![QUANT] - rs4!QUANT
With rs2
.AddNew
!Codigo = rs3!Codigo
!descricao = rs3!descricao
!QUANT = QUANTS
!VUNI = rs3!VUNI
!Uni = rs3!Uni
!DATA = rs3!DATA
!CFOP = rs3!CFOP
!qnfe = rs3!QUANT
!qnfs = rs4!QUANT
.Update
End With
Wend
rs2.Close
Set rs2 = Nothing
rs3.Close
Set rs3 = Nothing
rs4.Close
Set rs4 = Nothing
Set db = Nothing
End If