473,786 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8276
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\D evelopment\Mark et~1.MDB
the result in the messagbox is
C:\AccessApps\D evelopment\

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\Dev elo~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
1682
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 Main.mdb to Temp1.mdb as follows: From Main.mdb:
4
1329
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 Tables screen. Does anybody know a function or routine that can do this? Thanks in advance for any help!
9
27581
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 "C:\MyDocs\" thanks T Martin
1
10823
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 them is to query "qry_last_transition," which is also a parameter query. Both querys use the same parameter: a control called "txtSecondDate" on a pop up form. What I've been trying to do up to this point is to open up this parameter form,...
0
1657
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 temporary table in MS Access as its datasource (loaded via a Make Table query). If I create the temporary table and then open the mail merge document from within MS Word and click "Merge to New Document", the information from the temporary table is...
7
4998
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 "qapp_RecsNotYetArchived", dbFailOnError CommitTrans End Sub
3
15788
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 fine, but receive errors when I change it to link CSVs. Sub mcrAllPermut_LinkExternalTables() Set db = CurrentDb strDir = "C:\"
3
8633
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 same Access database, if that means anything. I forgot to put the blank parentheses but I'm not finished building the recordset. I'm betting it will work just fine. Why and when (and what) would anything go inside those parentheses?
1
3742
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 object is empty even though I have two tables in the database. I'm using the code below, but the combobox remains empty. That's because CurrentDB.Recordsets is empty. Is this a bug with CurrentDb or have I done something dumb? Dim TBL As...
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10108
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.