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 27545
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(CurrentProject.FullName, InstrRev(CurrentProject.FullName, "\"))
--
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.*********@heuvelqop.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********@charter.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*********@SeeSig.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(CurrentProject.FullName, InstrRev(CurrentProject.FullName, "\"))
-- 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 @ stanleyassociates . com> wrote in message
news:30*************@uni-berlin.de... Or: CurrentProject.Path
Thanks for all the options
"T Martin" <ma********@charter.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 =...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |