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 9 27574
T Martin wrote: 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\ "
Function ourPath() As String
Dim cRes As String
Dim nPos As Long
cRes = CurrentDb.Name
nPos = Len(cRes)
Do Until Right(cRes, 1) = "\"
nPos = nPos - 1
cRes = Left(cRes, nPos)
Loop
ourPath = cRes
End Function
--
Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Bas' solution will work for any version of Access.
From Access 2000 onward, you can just use:
Left(CurrentPro ject.FullName, InstrRev(Curren tProject.FullNa me, "\"))
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Bas Cost Budde" <b.*********@he uvelqop.nl> wrote in message
news:cn******** **@news2.solcon .nl... T Martin wrote: 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\ "
Function ourPath() As String Dim cRes As String Dim nPos As Long cRes = CurrentDb.Name nPos = Len(cRes) Do Until Right(cRes, 1) = "\" nPos = nPos - 1 cRes = Left(cRes, nPos) Loop ourPath = cRes End Function -- Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html I prefer human mail above automated so in my address replace the queue with a tea
"T Martin" <ma********@cha rter.net> wrote: 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
The following will break it down to:
"C:\MyDocs\MYDB .mdb"
"C:\MyDocs\ "
"MYDB.mdb"
Function CurrentDBDir() As String
Dim strDBPath As String, strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBDir = strDBPath & vbCrLf & _
Left(strDBPath, Len(strDBPath) - Len(strDBFile)) & vbCrLf &
_
strDBFile
End Function
--
»«»«»« Graham »«»«»«
strCurrentDir = Left(strDB, Len(strDB) - Len(Dir(strDB)) )
strDB = CurrentDb.Name
strCurrentDir = Left(strDB, Len(strDB) - Len(Dir(strDB)) )
Johan wrote: strDB = CurrentDb.Name strCurrentDir = Left(strDB, Len(strDB) - Len(Dir(strDB)) )
Clever! to subtract the filename, as it were. I'll stick that in my toolbox.
--
Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Or: CurrentProject. Path
- Steve
"Allen Browne" <Al*********@Se eSig.Invalid> wrote in message
news:41******** *************** @per-qv1-newsreader-01.iinet.net.au ... Bas' solution will work for any version of Access.
From Access 2000 onward, you can just use: Left(CurrentPro ject.FullName, InstrRev(Curren tProject.FullNa me, "\"))
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
Thanks, Steve
Doesn't get much simpler than that!
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Stephen K. Young" <s k y @ stanleyassociat es . com> wrote in message
news:30******** *****@uni-berlin.de... Or: CurrentProject. Path
Thanks for all the options
"T Martin" <ma********@cha rter.net> wrote in message
news:CU******** ***@fe12.lga... 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dan Nash |
last post by:
Hi guys
I have a page that is *supposed* to list the directories on the server.
Here's the code...
folderspec = server.MapPath("./images/")
set fso = CreateObject("Scripting.FileSystemObject")
set fold = fso.GetFolder(folderspec)
for each subfolder in fold.subFolders
Response.Write(subfolder.name & "<br>")
|
by: Daniel |
last post by:
How do you get the current directory of the actual .exe file (not the file
name but the directory it is in) ?
These do not work:
System.IO.Directory.GetCurrentDirectory() - returns system directory not
current directory of .exe
System.Environment.CurrentDirectory - returns system directory not current
directory of .exe
System.Reflection.Assembly.GetExecutingAssembly().Location - returns the
file name of the current binary
|
by: kk |
last post by:
Can any function tell the compiled program executing path? after using the
program to open a file from MFC dialog box, the path changes. thks in
advance.
|
by: First Tiger |
last post by:
Is there a default function or global variable that will allow me to derive
the location of my install? I'm trying to store my system settings file from
a persistent location. I know that I can set it through code but I want the
option to install the same application multiple times on the same computer
so I can foresee that being an issue. Any help or direction would be greatly
appreciated.
Sincerely,
FT
|
by: Progman |
last post by:
I use Visual Studio 2005
When I run
msgbox Curdir(), I get the visual studio directory.
This problem seems to be only in the VB part. In the ASP, we use ~/etc... to
access files.
Why I dont get my project directory?
| |
by: Arthur |
last post by:
Hi All,
I would like to get the name of the user given their networkID, is this
something Active Directory would be useful for?(For intranet users)
If so, can you please point me to some sample code/examples?
Thanks in advance,
Arthur
|
by: Chris Mellon |
last post by:
This appears to be a change in behavior from Python 2.4 to Python 2.5,
which I can't find documented anywhere. It may be windows only, or
related to Windows behavior.
In 2.4, the current directory (os.curdir) was on sys.path. In 2.5, it
appears to be the base directory of the running script. For example,
if you execute the file testme.py in your current working directory,
'' is on sys.path. If you execute c:\Python25\Scripts\testme.py,...
|
by: greg |
last post by:
Hi all,
Is there a way to get the current theme name at design time?
I'm trying to write a custom control for which I need to use images from the
current theme. I have asigned a theme to the page as well as in the
web.config.
The control looks ok at run time but when viewed in the Visual Studio
designer it cannot pick up the current theme.
|
by: duyanning |
last post by:
I have written a pyhton script that will process data file in current
working directory.
My script is in an different directory to data file.
When I debug this script using pdb within emacs, emacs will change the
current working directory to the directory which include the script,
so my script cannot find the data file.
I think this is the problem of emacs because when I start pdb from
console directly, it will not change current...
|
by: Kakkanattu |
last post by:
Hi,
In desktop application, we use different ways to get the current
execution directory.
I. AppDomain.CurrentDomain.BaseDirectory
II. Environment.CurrentDirectory
III. Directory.GetCurrentDirectory()
IV. Assembly.GetExecutingAssembly().Location
Can u please help me to know the difference of all these? Also is
there any other way to get the current directory other than the above?
|
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...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |