Sad Der
accessd666 at yahoo.com
Wed May 2 06:44:12 CDT 2007
Thnx for the reply but I already solved it. Btw it doesn't return a string but a ADODB.COnnection: Private madoConn As ADODB.Connection 'ADOConnectie Public Function CreateConnection(...params...) As ADODB.Connection ... Set CreateConnection = madoConn End Function Sander --- Jim Lawrence <accessd at shaw.ca> wrote: > Hi Gustav: > > What connection string is the class/collection/type > gDataSvr.GetConnection() > returning? > > Debug.print gDataSvr.GetConnection() > > Jim > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On > Behalf Of Sad Der > Sent: Tuesday, May 01, 2007 1:54 AM > To: Acces User Group > Subject: [AccessD] Set recordsource of a form > dynamically?! > > 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 > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam > protection around > http://mail.yahoo.com > -- > 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 > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com