[AccessD] Problem Creating ADO recordset

Gustav Brock Gustav at cactus.dk
Sat Jul 18 12:16:16 CDT 2009


Hi Arthur

If you google a little on this, the common source is a missing or faulty reference.
Try to remove the ADO reference, close and open and add it again and compile.

/gustav


>>> fuller.artful at gmail.com 18-07-2009 17:28 >>>
I now think that the problem lies in my reference to
CurrentProject.Connection. The code goes like this:

<vba>
Dim rs as ADODB.RecordSet
Set rs = New ADODB.RecordSet
Dim sSQL as String
sSQL = "SELECT * FROM my_query"
rs.Open sSQL, CurrentProject.Connection, adOpenDynamic
</vba>

It crashes on the last line. When I go into the debug window and issue:

? CurrentProject.Connection. 'and then any of the attributes, such as
connectionstring

It immediately errors out: Error 459: can't create ActiveX object.

This code used to work just fine, but something has changed and I'm at loss
to know what has changed. Since I am connected to the database and prior to
this call I'm processing lots of data, I can't figure out why I can't use
CurrentProject.Connection.

Any insights or alternative approaches greatly appreciated.

TIA,
Arthur






More information about the AccessD mailing list