[AccessD] Problem Creating ADO recordset [Was:] Sudden problem with creating a Word object

Arthur Fuller fuller.artful at gmail.com
Sat Jul 18 10:28:30 CDT 2009


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


On Sat, Jul 18, 2009 at 10:35 AM, Max Wanadoo <max.wanadoo at gmail.com> wrote:

> ok
>
> Max
>
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
> Sent: 18 July 2009 15:29
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Sudden problem with creating a Word object
>
> It turns out that I jumped to a conclusion, and my code was failing before
> it ever got to the line where it creates the Word object. It tries to
> create
> an ADODB.recordset, using a query that returns no records. I don't know why
> the query is failing, but I'll look into that right now.
>
> Arthur
>
> On Sat, Jul 18, 2009 at 9:43 AM, Arthur Fuller
> <fuller.artful at gmail.com>wrote:
>
> > Thanks, Max. I'll give it a try.
> >
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list