get current drive

I

iccsi

I just wonder any function to get mdb current driver?

Your information is great appreicated,
 
K

Klatuu

If you mean the drive letter the mdb is on:
Left(CurrentProject.Path,2)
Or what do you mean by driver?
 
D

Daniel Pineault

Drive or driver? I'm assuming drive. Correct me if I'm wrong.

You don't mention whether or not your db is split or not and if so if you
want the drive of the front-end or back-end.

if it is not split then it is really simple

CurrentProject.Path

This will return the full path of the current database. Then you can simply
extract the part you are interested in by doing something like

Left(CurrentProject.Path,instr(CurrentProject.Path,"\"))
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.com/index.php
Please rate this post using the vote buttons if it was helpful.
 
D

Douglas J. Steele

I realize that. However, while the OP might want a drive letter, it's
possible that the application could return a UNC. This should only happen if
they opened the application using a shortcut that contained a UNC, or if
they opened Access, then opened the application by navigating to the file
through the Network Neighborhood. If that's the case, then the code from
http://www.mvps.org/access/api/api0003.htm at "The Access Web" should help
to determine what the drive letter should be, assuming that a drive IS
mapped to that share. (Of course, it's always possible that more than one
drive could be mapped to the same share!)

Yes, I know I'm picky!
 
K

Klatuu

I don't disagree with you at all, Doug. Guess I was a little lazy on this.
And there is the situation (we have it here) where the be is linked to an
unmapped server. We do it as one of the "ignorance is the first line of
security". If the user's don't have it mapped, they can't mess with the be
because in most cases they don't know how.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

collection 2
pass strings to a function 12
treeview ActiveX control 1
MDB security 1
shell running multi instance 1
Ryzen 7 2700x or Ryzen 5 5800x 1
Hello from Me. 5
Current Directory 1

Top