Click to See Complete Forum and Search --> : VB6 - Locate/Access Database in a Server directory


Giftx
November 16th, 2007, 04:44 PM
Hi everyone,
I am attempting to access a database that is located in a shared server/ directory "K:\". Assuming I don't know where the database is located, how can I programatically tell vb to locate this database by searching all the network server directories?

My database name is called:
PTS.mdb

Currently I copied the database into my local drive for testing purposes.
"C:\PTS.mdb"


This is how I'm accessing the database now:

Dbpath = "C:\"
DbName = "PTS"

Set Db = OpenDatabase(Dbpath & DbName)


Any input will be greatly appreciated.
Thanks.
GiftX

dglienna
November 16th, 2007, 05:08 PM
You are going to have to let the user choose it the first time, and then save it somewhere so it can be loaded automatically.

There's no way you can 'find' a db. You wouldn't have permission probably.

Giftx
November 19th, 2007, 04:27 PM
Hi dg.
That's not really the case here. The database is in a centralized location and everyone can point to it and access it from their workstation.

For example, this is the location of my department's database which is hard code in my module:

\\515opsisdallf00008\SHARED\PyrlApps\PTSprod\PTS.mdb

Suppose I don't know the part, how do I search/locate this database?

Thanks.
tgif

dglienna
November 19th, 2007, 04:44 PM
You know this: \\515opsisdallf00008\SHARED\
and the db name that you are looking for?

You could write an app to search recursively all the folders on that share, but, as I said, there may be permission issues, or duplicates.

erickwidya
November 20th, 2007, 08:57 PM
i think u can't do something like that..u'll end up searching entire network..

Suppose I don't know the part, how do I search/locate this database?maybe what u ask is instead changing the DBPath inside the program, u want it to be dynamic so u don't need to re-coding it again?

u can use .INI file as external file so if the Path is changing, u only changing the .INI file