I wander in time of execution 3704

F

Frank Dulk

Operation is not allowed when the object is closed.

Function lancaproduto()
Set tabela1 = New ADODB.Recordset
Set tabela = New ADODB.Recordset
tabela1.Open "SELECT * FROM tbl_cad_produto WHERE codbarra_prod = '" &
Me.codprod & "'", CurrentProject.Connection
tabela.Open "insert into tbl_lanc_venda_produtos(id_venda, cod_prod,
qtde, vrunit, vrtotal) values (" & Me.id_venda & "," & tabela1!cod_prod &
",1 ,' " & Me.vrunit & " ',' " & Me.vrtotal & " ')",
CurrentProject.Connection
Me.tbl_lanc_venda_produtos_subform.Requery
Me.vrunit = 0
Me.codprod = ""
' / / / / / I wander here in tabela.close, where has .close
tabela.Close
tabela1.Close
Set tabela = Nothing
Set tabela1 = Nothing
End Function
 
P

Paul Overway

You're not getting a recordset...you're executing an SQL statement. There
is no recordset to close. It would be clearer to use the command object
(set .CommandText and then .Execute).
 
Top