473,404 Members | 2,114 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,404 software developers and data experts.

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 4918
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********@ntlworld.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*****@localhost.not> wrote in message
news:REWJd.944$SP4.577@trnddc07...

"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
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...
2
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
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...
1
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 =...
4
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 =...
2
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 ==...
1
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...
8
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...
0
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...
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
0
BarryA
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...
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
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,...
0
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...
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...

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.