473,581 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CurDir

Ian
Can someone tell me what CurDir returns, I am trying to find the path to the
Drive letter where Windows is installed on a PC, using code like:

Function DriveLetter()

Dim curdrv As String

curdrv = Left(CurDir, 2)

curdrv = curdrv & "\"

MsgBox "" & curdrv

The help file says that CurDir returns the path for the Current Drive but I
am not sure what CURRENT DRIVE means, is this the drive with the operating
system?

Tanks
Nov 13 '05 #1
6 4927
CurDir returns the full path of the folder that holds the current Database .
Try typing in ?CurDir() in the immediate window

HTH

Phil
"Ian" <ia********@ntl world.com> wrote in message
news:ZK******** *******@newsfe3-win.ntli.net...
Can someone tell me what CurDir returns, I am trying to find the path to
the
Drive letter where Windows is installed on a PC, using code like:

Function DriveLetter()

Dim curdrv As String

curdrv = Left(CurDir, 2)

curdrv = curdrv & "\"

MsgBox "" & curdrv

The help file says that CurDir returns the path for the Current Drive but
I
am not sure what CURRENT DRIVE means, is this the drive with the operating
system?

Tanks

Nov 13 '05 #2
Phil Stanton wrote:
CurDir returns the full path of the folder that holds the current
Database . Try typing in ?CurDir() in the immediate window


No it doesn't. It returns whatever folder Windows considers the current
directory which might or might not be the one where the MDB resides.

You can use...

CurrentDB.Name
or
CurrentProject. Path (Access 2000 or newer)

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #3
Ian
So how can I find the path to the Drive letter where Windows is installed on
a PC, which I would call the Current Drive. If my operating system is on the
D Drive I want it to return D:\
Any ideas?
Nov 13 '05 #4

"Ian" wrote
Can someone tell me what CurDir
returns, I am trying to find the path
to the Drive letter where Windows
is installed on a PC, . . .


As Rick stated, CurDir returns whatever Windows considers the "currently
selected directory", which isn't what you want. Rick gave you what is needed
to return the Folder where the current database or project is stored. And,
there is a Windows API that will return the information you want about
Windows. You'll find Access example code for using it at
http://www.mvps.org/access/api/api0010.htm.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #5
Ian

"Larry Linson" <bo*****@localh ost.not> wrote in message
news:REWJd.944$ SP4.577@trnddc0 7...

"Ian" wrote
> Can someone tell me what CurDir
> returns, I am trying to find the path
> to the Drive letter where Windows
> is installed on a PC, . . .
As Rick stated, CurDir returns whatever Windows considers the "currently
selected directory", which isn't what you want. Rick gave you what is

needed to return the Folder where the current database or project is stored. And,
there is a Windows API that will return the information you want about
Windows. You'll find Access example code for using it at
http://www.mvps.org/access/api/api0010.htm.

Larry Linson
Microsoft Access MVP


Thank Larry

That is exactly what I need, I did check this web site first but somehow
missed it. This is not the first time you have helped me and I do appreciate
it.

Regards
Nov 13 '05 #6
"Ian" wrote
Thank Larry
You're welcome. I'm glad I was able to be of some assistance.
That is exactly what I need, I did
check this web site first but somehow
missed it.
There's so much there that it is easy to overlook something. In fact, I had
to visit there to make sure I remembered correctly that there was such an
article.
This is not the first time you have
helped me and I do appreciate
it.


Your appreciation makes it worthwhile. Again, you are most welcome. Helping
is what newsgroups are for.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4152
by: Per Erik Stendahl | last post by:
Hello everyone, Is it possible to define "static properties" in a class? Example: I have a class, Path, that wraps a lot of os.* and os.path.* functions (and others), so I can write things like this: x = Path('/usr/local/some/file') if x.IsFile:
2
7979
by: Dave | last post by:
In VB .Net I can get the current directory using the CurDir() function. Does C# have a similar function. Or how can I discover the current path in C#?
1
6831
by: Lance | last post by:
Hi All, I change the current directory in a proc, using CurDir(). The change persists across executions. I would like the CurDir() return value to be the same at the start of each execution. Any suggestions will be appreciated. The code below illustrates the problem. Thanks. Dim currentDir As String MsgBox CurDir()
1
1261
by: RAJ | last post by:
Hi, I am acccessing my crystal reports bundled version developed in VB.NET 2002. I stored my report in local C drive and set the report source as follows: rptPositiveMatch.ReportSource = CurDir() & "\Report\PositiveMatch.rpt" But I got the error "Load Report Failed". I checked the path while running the report, but it goes to different...
4
2805
by: eBob.com | last post by:
I have a "parent" form (if that's the right terminology), Form1. I declare two public values in the parent form : Public Class Form1 Inherits System.Windows.Forms.Form Public CurDir As String = Directory.GetCurrentDirectory() 'used by FormGetJobOutput Public PubUser As String 'tbxUser.text value for subForms In the "child" form, I call...
2
6993
by: Tatu Portin | last post by:
I need to implement simple function to get current directory from program directory. e.g. /home/tatu/src/main -> /home/tatu/src where main is the currently running program. i.e. argv == /home/tatu/src/main. First, I did it with C-style: // start-of-file
1
3222
by: Xah Lee | last post by:
The following is a program to generate thumbnail images for a website. Useful, if you want to do that. It is used to generate the thumbnails for my “Banners, Damsels, and Mores” project gallery. ( http://xahlee.org/Periodic_dosage_dir/lanci/lanci.html ) Comments and versions in other lang welcome. Xah
8
2134
by: =?Utf-8?B?R2VvcmdlQXRraW5z?= | last post by:
Greetings! I wrote a small Exe that simply runs Shell to load PowerPoint and launch a particular file, depending on the day of the week. However, it was set up for office 2003 (I naively hardcoded the path) and I also used Shell. Does anybody have a snipped showing a more efficient method for launching a Powerpoint file, regardless of which...
0
1468
by: Renatebhp | last post by:
While using CurDir to get the current path where my open workbook is located, I get a result that's short of the current folder.e.g. the path to the file is C:\FolderLv1\FolderLv2\FolderLv3\Myfile.xls And CurDir returns: C:\FolderLv1\FolderLv2 This creates a problem when trying to open the next xls file in the same folder. Can anyone...
0
7808
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...
0
8157
Oralloy
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. ...
0
8312
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6564
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5683
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...
0
5366
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...
0
3809
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...
1
2309
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
1
1410
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.