Debug a code(3709 error)

F

fox

Hi!
I am trying to debug a code, but I don't know what cause it.
The module code is
Dim tempCtl As ADODB.Recordset
Set tempCtl = New ADODB.Recordset
With tempCtl
.ActiveConnection = Gcn
.Open Source:="Select * " & _
" From [Ctl] " & _
" Where [CtlType] = '" & newCtlType & "' " & _
" And [CtlKey] = '" & newCtlKey & "'"
.................
end with

It show "Run-time error '3709': The connection cannot be used to perform
this operation. It is either closed or invalid in this context." after
excuting .Open Source:
Could someone tell me where I miss? Thank you very much.

fox
 
T

Tim Ferguson

.ActiveConnection = Gcn
.Open Source:="Select * " & _
" From [Ctl] " & _
" Where [CtlType] = '" & newCtlType & "' " & _
" And [CtlKey] = '" & newCtlKey & "'"

It show "Run-time error '3709': The connection cannot be used to perform
this operation. It is either closed or invalid in this context." after
excuting .Open Source:

What is Gcn -- where is it defined and is it definitely open?

What are the contents of newCtlType and newCtlKey? Is there any chance of
SQL insertion going on?

Tim F
 

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