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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move Database and Exe to a different location

Status
Not open for further replies.

ZmrAbdulla

Technical User
Apr 22, 2003
4,364
0
0
AE
Hi,

I am very young in VB
Here is my question
I managed to create an access database and a form

The recordsource of the exe will be like below

C:\Documents and Settings\Desktop\Telephone\Address.mdb
If I move the folder "Telephone" to a different location I am getting an error

"Data Error event hit err:Couldn't find the file C:\Documents and Settings\Desktop\Telephone\Address.mdb"

How can I make the path available even if I move the folder to a different location?





Zameer Abdulla

 
If you keep the EXE and MDB in the same folder you could use App.Path & "\Address.mdb", rather than hard coding a folder name as in "C:\Documents and Settings\Desktop\Telephone\Address.mdb", that way it shouldn't matter where your files sit.

Pete Vickerstaff - Hedra Software
 
Or when you run your app have it read a path from an ini file or from the registry, and if it doesn't find it prompt the user to locate the file.

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"A computer program does what you tell it to do, not what you want it to do." -- Greer's Third Law
 
Code:
Private Sub Form_Load()
  MsgBox App.Path
End Sub
will tell you which directory the program is being run in.

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"A computer program does what you tell it to do, not what you want it to do." -- Greer's Third Law
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top