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'
Who is Participating?
What I have is on the start up form (could be a login form) there will be a browse button to set the path to where the db reside.

Any where I make the connection, I use the path that the client provided. You seemed to be on the right path so what’s wrong?
mlcktmguyAuthor Commented:
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.
mlcktmguyAuthor Commented:
Got it:

DataEnvironment1.Connection1.ConnectionString = strConnect
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.