dbTalk Databases Forums  

CurDir

comp.databases.ms-access comp.databases.ms-access


Discuss CurDir in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Phil
 
Posts: n/a

Default CurDir - 08-09-2011 , 11:44 AM






2 computers the one running Windows XP has a database running in
C:\Documents and Settings\Phil\MyDocuments\Access\MDB 2010.

The computer running windows 7 reports the folder is either
C:\Phil Data\Access\MDB 2010 or C:\My Documents\Access\MDB 2010

In the former case, typing ?CurDir in the immediate window gives
(incorrectly???) "C:\Documents and Settings\Phil\MyDocuments" The windows 7
version gives "C:\Phil Data\Access\MDB 2010"

What is CurDir supposed to return.
I want to point to a referenced database in the Access\MDB 2010 folder and
have used .\Utilities.AccDb perfectly successfully as the path on the Windows
7 machine, but of course the XP machine gives a file not found error Any
ideas pleas Thanks
Phil

Reply With Quote
  #2  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: CurDir - 08-10-2011 , 02:41 PM






"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in
news:j1ro55$g87$1 (AT) speranza (DOT) aioe.org:

Quote:
What is CurDir supposed to return.
It returns the Current Directory as specified by your operating
system. This may or may not be what you think it is.

I find CurDir to be basically useless, as it's way to unpredictable
what it's going to return. So, instead, I just make sure I specify
paths in full in all cases. That way, I don't really need to know
what the current directory is set to.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #3  
Old   
Phil
 
Posts: n/a

Default Re: CurDir - 08-10-2011 , 05:05 PM



On 10/08/2011 20:41:34, "David-W-Fenton" wrote:
Quote:
"Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in
news:j1ro55$g87$1 (AT) speranza (DOT) aioe.org:

What is CurDir supposed to return.

It returns the Current Directory as specified by your operating
system. This may or may not be what you think it is.

I find CurDir to be basically useless, as it's way to unpredictable
what it's going to return. So, instead, I just make sure I specify
paths in full in all cases. That way, I don't really need to know
what the current directory is set to.

Thanks David.
Originally I "hard wired" the path of the referenced database
(Utilities.Accdb), but that path is different on different machines.
".\Utilities" works OK on the Windows 7 machine as I keep Utilities.AccDb in
the same folder as the access application, but on the other machine, it cant
finf the file as the pointer appears to go to My Documents instead of the
folder where the database is stored. Any ideas how to tell the program to
find the right file. Don't know of a FileScripting routine that will do it or
any other .\* (DOS) sort of combination. Thanks
Phil

Reply With Quote
  #4  
Old   
Tony Toews
 
Posts: n/a

Default Re: CurDir - 08-10-2011 , 05:21 PM



On Wed, 10 Aug 2011 23:05:01 +0100, "Phil" <phil (AT) stantonfamily (DOT) co.uk>
wrote:

I agree with David's comments on CurDir.

Quote:
Originally I "hard wired" the path of the referenced database
(Utilities.Accdb), but that path is different on different machines.
".\Utilities" works OK on the Windows 7 machine as I keep Utilities.AccDb in
the same folder as the access application, but on the other machine, it cant
finf the file as the pointer appears to go to My Documents instead of the
folder where the database is stored.
application.CurrentDb.Name will give you the current path and name of
your Access database file. From there you can parse out the path,
etc.

Tony


--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

Reply With Quote
  #5  
Old   
Phil
 
Posts: n/a

Default Re: CurDir - 08-12-2011 , 04:36 AM



On 10/08/2011 23:21:33, Tony Toews wrote:
Quote:
On Wed, 10 Aug 2011 23:05:01 +0100, "Phil" <phil (AT) stantonfamily (DOT) co.uk
wrote:

I agree with David's comments on CurDir.

Originally I "hard wired" the path of the referenced database
(Utilities.Accdb), but that path is different on different machines.
".\Utilities" works OK on the Windows 7 machine as I keep Utilities.AccDb in
the same folder as the access application, but on the other machine, it cant
finf the file as the pointer appears to go to My Documents instead of the
folder where the database is stored.

application.CurrentDb.Name will give you the current path and name of
your Access database file. From there you can parse out the path,
etc.

Tony


Thanks guys.
Table of referenced items now has a column "ComputerName" so my query for
looking up the path of the Ulilities Db first determines the computer name,
then applies a filter. Works a treat, but probably will be a pain if the
application is run on a new computer Phil

Reply With Quote
  #6  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: CurDir - 08-13-2011 , 04:35 PM



Tony Toews <ttoews (AT) telusplanet (DOT) net> wrote in
news:fu0647ll2gpo9abios5hic7qi2eqnbuem0 (AT) 4ax (DOT) com:

Quote:
On Wed, 10 Aug 2011 23:05:01 +0100, "Phil"
phil (AT) stantonfamily (DOT) co.uk> wrote:

I agree with David's comments on CurDir.

Originally I "hard wired" the path of the referenced database
(Utilities.Accdb), but that path is different on different
machines. ".\Utilities" works OK on the Windows 7 machine as I
keep Utilities.AccDb in the same folder as the access application,
but on the other machine, it cant finf the file as the pointer
appears to go to My Documents instead of the folder where the
database is stored.

application.CurrentDb.Name will give you the current path and name
of your Access database file. From there you can parse out the
path, etc.
Or CurrentProject.Path.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.