• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 140
  • Last Modified:

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'
  • 2
1 Solution
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now