473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How to get directory for CurrentDB

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
5 8241
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: R Bolling | last post by:
My question is based on the following scenario: If you put two MDB files on a network share such as: \\ServerName\Shared1\Main.mdb \\ServerName\Shared1\Temp1.mdb You can copy a table from...
4
by: Mike I. | last post by:
I have a database that contains linked tables from a second database. I want to programmatically determine the directory the second database resides in based on what is entered into the Linked...
9
by: T Martin | last post by:
Is there a way that I would be able to get the current directory of the database I am working in. Example: If my database were in "C:\MyDocs\MYDB.mdb" then I would like the code to return...
1
by: jnikle | last post by:
I have a parameter query named "qry_employee_info_reports" that I need to run in the OnOpen event of a form. I'm after its total number of records. The query's got several joins in it, and one of...
0
by: Sheila | last post by:
I have set up a Word mail merge document of the type Directory which allows me to display all of the records on a single page rather than putting each record on a separate page. It uses a...
7
by: Tony M. | last post by:
I'm trying to execute an append query. I have a case that works, and one that returns an object not set error. THIS WORKS: Private Sub cmdArchiveRecs_Click() BeginTrans CurrentDb.Execute...
3
by: Butaambala | last post by:
Hello, I am attempting to write a procedure that will loop through a directory of CSV files, linking each of them to a database. I have tested the following code for XLS files, and it works...
3
by: Richard Hollenbeck | last post by:
In DAO, is there any difference between "set db = CurrentDb()" with parentheses and "set db = CurrentDb" without parentheses? I'm just looking for data from a single field in a table inside the...
1
by: sphinney | last post by:
As my Access form opens, I want it to find the names of the tables in the current Access database and populate a combobox with the table (recordset) names. Problem is, the CurrentDb.Recordsets...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.