Error when adding record on a recordset openned by a view.

  • Thread starter Thread starter Gaston
  • Start date Start date
G

Gaston

Set ListDescRs = New Recordset
ListDescRs.CursorLocation = adUseClient
Set ListDescRs.ActiveConnection = Conn
ListDescRs.Open "Select * from cpo_ped_view where codpedido = " &
abmForm.SelectionID & " order by codcpoped", , adOpenKeyset,
adLockOptimistic

Set ListDescRs.ActiveConnection = Nothing
ListDescRs.AddNew
FormPedido.ListDescRs.Fields("producto") = "SWEATER" --->>>> ERROR
IN THIS LINE



ERRORRR
 
You are closing the recordset before doing the .addnew

Move this line:
Set ListDescRs.ActiveConnection = Nothing
to be the last line in your code.

Setting the object to Nothing closes the recordset.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top