error 3709

W

warway

I get VB error 3709 - The connection cannot be used to perform this
operation. It is either closed or invalid in this context. Stopping at the
Set rs = CMD.Execute line when running the code below:

All I want to happen is for the ShipmentID field in the sp_ShipmentCurrent
recordset to be stored as exisitngShipmentID for future use. I have adapted
the SQL BOL sample but cannot get it to work. Thanks in advance for your
help!

Dim cn As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim Cmd As New ADODB.Command

Set cn = CurrentProject.Connection

Cmd.CommandText = "sp_ShipmentCurrent"
Cmd.CommandType = adCmdStoredProc

Set rs = Cmd.Execute

With rs
existingShipmentID = !ShipmentID
..Update
rs.Close
End With


Warway
 
T

TC

I don't know anything about ADODB, but - where do you actually use 'cn'?
Should you be saying CN.cmd or somesuch?

HTH,
TC
 

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

Top