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

apppath , shell or both need help. thank you

Status
Not open for further replies.

compcad

Programmer
Mar 22, 2002
52
US
could you give some samples or ideas of how this should work
thanks

i have a program i created from vb6 the default path to this program is as
follows:

C:\RaffleMaker\TBLITE\Tblite.EXE

i also have a database that is used by the Tblite.EXE this database is
located in a default path:

C:\RaffleMaker\RMdesktop\whdata.MDB

is what i need help with is how should i set up shell or app.path or even
both to access whdata.mdb from tblite.exe if the path was set up on
another drive or network other than C:\
right know i have it setup as:

If Dir$("c:\Program files\Rafflemaker\Rmdesktop\whdata.mdb") > "" Then
Data1.DatabaseName = "c:\Program files\Rafflemaker\Rmdesktop\whdata.mdb"
Data1.Connect = ";PWD=TheSecretPassword"
 
how about something like

DBPath = Mid(App.Path, 1, 3) & "RaffleMaker\RMdesktop\whdata.MDB"

good luck!

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
come on... get involved!
To get the best response to a question, please check out FAQ222-2244 first
A General Guide To Excel in VB FAQ222-3383
 
You can also use the common dialog to allow the user to browse to the database and then store the location in the registry with the savesetting function. Next time the program is run you can retrieve the path with the getsetting function and make your connection. If you can't connect (first time being used, database moved, registry corrupt) you can have the user browse again to reset the path.

Take Care,

zemp

"Show me someone with both feet on the ground and I will show you someone who can't put their pants on."
 
You can use the path C:\RaffleMaker\RMdesktop\whdata.MDB as default and as error condition (when the location if different from C:\) display a common dialog to let user select data from the actual location...
 
how about something like

DBPath = Mid(App.Path, 1, 3) & "RaffleMaker\RMdesktop\whdata.MDB"

good luck!

what is the 1 and the 3 referring to

THANK YOU
 
the 1 is the start position and the 3 is number of characters!

see MSDN for "Mid Function" for further details!

good luck!

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
come on... get involved!
To get the best response to a question, please check out FAQ222-2244 first
A General Guide To Excel in VB FAQ222-3383
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top