Problem opening a recordset ...

Eniac

Canadian Nerd
Local time
, 21:30
Joined
Jun 8, 2004
Messages
23
Here's a part of the function I'm doing : (I'll explain prob after)
Code:
Private Sub Load_Association_Labels()
Dim objXML As MSXML2.DOMDocument40
Dim objStream As ADODB.Stream
Dim objConn As ADODB.Connection
Dim objRS As ADODB.Recordset
Dim strSQL As String

Set objConn = CurrentProject.Connection
Set objRS = New ADODB.Recordset

strSQL = "SELECT Owner, Code, Value From CD_Labels L, Constants C Where L.CD_Lang__ID = C.Language Order By Owner"

Set objRS.ActiveConnection = objConn
objRS.Open strSQL, , adOpenForwardOnly, adLockReadOnly
objRS.Save objStream, adPersistXML
objRS.Close
Set objRS = Nothing
Set objConn = Nothing

Set objXML = New MSXML2.DOMDocument40
Call objXML.loadXML(objStream.ReadText())
Set objStream = Nothing


End Sub

I'm pretty confident that the chunk of code works (even if the function is currently imcomplete)

What bugs me is that I cannot understand why would this line fail :

Code:
Set objRS.ActiveConnection = objConn

I get this :

Run-time error '-2147457259 (80004005)'

Method 'Open' of object '_Recordset' failed

I saw this error once, when I was working on a project who used COM a lot. But in the case of Access.... I'm still pretty clueless as to what might be causing it.

If it makes any difference, I'm using ADO 2.7.

<edit>
LOL, forgot the most important part, I'm using MS Access 2002 :p
</edit>

Thank you for any insight you may provide.
 
Last edited:
Ah geez.... I cant believe I fell for that one.

I found the problem, my query was using "reserved" words and it was creating a problem with ADO.

Nevermind, sorry for bothering ya :)
 

Users who are viewing this thread

Back
Top Bottom