Sad Der
accessd666 at yahoo.com
Tue May 1 04:51:28 CDT 2007
Gustav,
Thnx for the reply. It returns a connection object.
Here's the code that works, i had to use
SET Me.RECORDSET
Dim rstSource As ADODB.Recordset
Set rstSource = New ADODB.Recordset
With rstSource
.ActiveConnection = gDataSvr.GetConnection()
.Source = "select * from treport"
.Open
End With
Set Me.Recordset = rstSource
Set rstSource = Nothing
--- Gustav Brock <Gustav at cactus.dk> wrote:
> Hi Sander
>
> Your gDataSvr.GetConnection() might return just a
> connection string and not a Connection object ...?
>
> /gustav
>
> >>> accessd666 at yahoo.com 01-05-2007 10:54 >>>
> Hi group,
>
> I'm using an A2k2 ADP with an SQL Server 2000
> database.
> In the File=>Connection properties there is a
> connection to the development server.
>
> Using an ini file I dynamically connect to the
> production server via a class cDataSvr.
>
> In a module I've declared the following:
> Public gDataSvr = cDataSvr
>
> In the load event of a form I instantiate a
> recordset
> using gDataSvr.
>
> When I try the the line:
> ?gDataSvr.GetConnection I get the connection
> settings
> of the production server.
>
> I've tried the following code:
>
> Dim rstSource As ADODB.Recordset
> Set rstSource = New ADODB.Recordset
>
> With rstSource
> .ActiveConnection = gDataSvr.GetConnection()
> .Source = "select * from treport"
> .Open
> End With
>
> Me.RecordSource = rstSource.Source
>
> Set rstSource = Nothing
>
> To my surprise I received DEVELOPMENT data instead
> of
> PRODUCTION data!?!
>
> My question:
> How do tell the form to use the connection of
> gDataSvr
> and NOT the connection instantiated in
> File=>Connection?!?!
>
> Regards,
>
> Sander
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com