By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,131 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,131 IT Pros & Developers. It's quick & easy.

How to get directory for CurrentDB

P: n/a
I am making data entry tool in Acc2K for several data collecting
centres. It is convenient to have several files (mde file, .mdb with
tables only etc) located in the same directory. To make linkage
automatically it is necessary to get the directory where all these files
are located. One way is to supply it through interaction with local
user. However, it would be easier to have reliable way to get this
infor automatically.
Does Somebody know such a reliable way. ( curdir() function can't help
in this situation)

--
V.Moltchanov

Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Vladislav Moltchanov <vl******************@ktl.fi> wrote in message news:<ca**********@oxygen.ktl.fi>...
I am making data entry tool in Acc2K for several data collecting
centres. It is convenient to have several files (mde file, .mdb with
tables only etc) located in the same directory. To make linkage
automatically it is necessary to get the directory where all these files
are located. One way is to supply it through interaction with local
user. However, it would be easier to have reliable way to get this
infor automatically.
Does Somebody know such a reliable way. ( curdir() function can't help
in this situation)


Use:

CurrentProject.Path

'--------------
'John Mishefske
'--------------
Nov 13 '05 #2

P: n/a
Salad wrote:

I don't understand you want. If you want the path/filename of the
current mdb, use
Currentdb.name

Or are you saying you have a front end and you might want to work on
backend mdbs in other directories and you want to set connections to
those tables?


You have understood me correctly.

My concern using CurrendDb.name was that in Access97( I still have to
use this for some old projects) the returned value may contain "~".
And I haven't found the ultimate confirmation that this is just a
feature of Access97, not some system options settings, so that some of
my customers running access2000 wouldn't have this short name version as
retune value for CurrendDb.name.

--
V.Moltchanov

Nov 13 '05 #3

P: n/a
almish wrote:

Use:

CurrentProject.Path

'--------------
'John Mishefske
'--------------

--
V. Moltchanov
Thanks it works well,
Could you advise something like that for Acc97, I still have to run it
also for some old projects.

Nov 13 '05 #4

P: n/a
Vladislav Moltchanov wrote:
Salad wrote:

I don't understand you want. If you want the path/filename of the
current mdb, use
Currentdb.name

Or are you saying you have a front end and you might want to work on
backend mdbs in other directories and you want to set connections to
those tables?


You have understood me correctly.

My concern using CurrendDb.name was that in Access97( I still have to
use this for some old projects) the returned value may contain "~". And
I haven't found the ultimate confirmation that this is just a feature of
Access97, not some system options settings, so that some of my customers
running access2000 wouldn't have this short name version as retune value
for CurrendDb.name.


REading your other response, you want the path. Here is something to try

Function GetPath()
Dim strPath As String
Dim intFor As Integer

strPath = CurrentDb.Name
For intFor = Len(strPath) To 1 Step -1
If Mid(strPath, intFor, 1) = "\" Then
GetPath = Left(strPath, intFor)
Exit For
End If
Next
MsgBox strPath
End Function

You could then get the path like
Dim strMDBPath As String
Dim strMDBPath = GetPath()

Thus if your filename of Currentdb.Name =
C:\AccessApps\Development\Market~1.MDB
the result in the messagbox is
C:\AccessApps\Development\

The ~ in the filename may really be the name of the MDB because of the
way it was saved/copied. But Access 97 does recognize long names in
Paths so you don't need to concern yourself that it will be looking for
C:\Access~1\Develo~1\Market~1.MDB
when using Currentdb.name

Nov 13 '05 #5

P: n/a
Vladislav Moltchanov wrote:
almish wrote:

Use:

CurrentProject.Path


You initially posted your version as A2000 and that's why I
suggested this.

If you haven't already then check out Salad's function - should
work in all versions.

--
'-------------------------------
' John Mishefske
'-------------------------------

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.