Error 3709 in Connection Statement - Help!

D

Debbie

Hi all,
I just created a 2003 database and copied the connection procedure I've used
in all other databases without a problem. Now I keep getting the error "3709
Requested operation requires an OLE DB session object which is not supported
by the current provider."

The libraries I have checked in references are Visual Basic for
Applications, MS Access 11.0 Object Library, Activie X Objects 2.8, MS ADO
Ext. 2.8 for DDL and Security. My connection code looks like this:

Dim OConn As New ADODB.Connection

OConn.Open "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents\DTS\Century21\PropertyMgmtBE.mdb;"

If OConn.Errors.Count > 0 Then
MsgBox "There was a problem connecting to the database. To re-establish
the connection, please close and reopen the form.", vbOKOnly, "Error!"
OConn.Close
End If

Set OpenConn = OConn

The error occurs when the code tries to use the connection. That code is:
Dim OConn As ADODB.Connection
Dim SQLCmd As ADODB.Command

Set OConn = New ADODB.Connection
OConn = OpenConn()

Set SQLCmd = New ADODB.Command
SQLCmd.ActiveConnection = OConn
SQLCmd.CommandText = "UPDATE Attorney SET Attorney.FirstName = 'Deb' WHERE
AttorneyID)=1"
SQLCmd.Execute

I have spent hours on this, I've recompiled, retyped, imported everything
into a new database and I cannot figure this out. Any help is SO VERY
appreciated. Thank you very much in advance.
Debbie
 
D

Douglas J. Steele

You need to use the Set keyword when calling the function:

Set OConn = OpenConn()

As well, the SQL you're trying to run is incorrect. Get rid of the closing
parenthesis in

WHERE AttorneyID)=1"
 
D

Debbie

Yes! That was it - I'm so glad you are not here to see how embarrassed I am!
I figured it would be something another set of eyes could pick up right
away. Thank you EVER SO MUCH, I will make sure that doesn't happen again!
Thanks -
Debbie
 

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