Link to home
Start Free TrialLog in
Avatar of mlcktmguy
mlcktmguyFlag for United States of America

asked on

changing data environment datalink properties in code

I am developing a VB6.0 app linked to an MS Jet/Access database on my machine.  Oviously the app will be distributed to my clients upon completion.  In the data enviroment, on the 'connection' tab of the datalink properties I enter the path where the MDB is located on my development machine, 'C:\TestApp\Client.MDB'.  This works great for testing but when I let the client install the app they do not have to use the same directory strcuture or even drive letters that I use in testing.

When the app is distributed how do I alter the 'connection' tab property to point to the production MDB.  The MDB may be in another directory that the one I tested with and will most likely be on a network drive rather than C:.

I am making some adhoc connections to the database using the following:

  dbName = "NEIntAndWeb.mdb"
 
  Open_Ini    'loads 'networkPath' based on values in the .ini
  strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & NetworkPath & dbName

can I overlay the Data Environment connection with 'strConnect'
ASKER CERTIFIED SOLUTION
Avatar of lunchbyte
lunchbyte

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mlcktmguy

ASKER

How to I overlay the dataenvironment connection set up in development mode to the correct connection in production mode?  The name of the data environment is DataEnvironment1, the connection is Connection1.
Got it:

DataEnvironment1.Connection1.ConnectionString = strConnect