Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Link Issue - Connection changes when using CommonDialog 1

Status
Not open for further replies.

MrsPie

Programmer
Jul 23, 2003
20
US
I'm building an application where the data tables (Access) are stored in the same file as the application, my connection string reads:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=FTED.mdb;Persist Security Info=False"

I added capability to export data to Excel - it all works great EXCEPT when I use the CommonDialog box to allow the user to select where to save the file.

The directory the user selects becomes the directory where my application looks for the data files!

The app.path doesn't change. I can correct my Data Environments by re-writing the ConnectionStrings, (although it is clumsy because the Data Environments are still wrong, changing the ConnectionString doesn't change the DataSource) but I'm using a few ADODC controls that also need to be reset so they can find the data files (again).

I don't want to hardcode the path, because I don't have control over where users install.

Does anyone know where the string is located for the DataSource, and how to either 1.) prevent it from changing when I use the CommonDialog, or 2.) reset it after using the CommonDialog? As I said before, it isn't App.Path.

Any help would be appreciated!
 

MrsPie, to get the most from this site please read FAQ222-2244.

You can use ...
[tt]
ChDir App.Path
[/tt]

Good Luck

 
Thank you so much! The ChDir works as long as they stay on the same drive - I added in ChDrive as well to make sure it would work if they decided to save to a different drive.

ChDrive Left(App.Path, 1)
ChDir App.Path

I really appreciate the help, and apologize if I was inappropriate in my request. I tried to follow the guidelines and guess I messed up somewhere.

Thank you again!
 

>if I was inappropriate in my request. I tried to follow the guidelines and guess I messed up somewhere

Oh no you didn't MrsPie, I tend to point everyone to that FAQ who seem to be new to these forums because it does contain good information on how to get the most from these forums.

And thanks

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top