Discussion Locked

find Sub directory

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I would like to know if anyone can tell me if there is a command that I can use to access a file by going to a sub directory.
If My Access is in the "report folder" and I have additional folders in "report Folder" like "documents","Templates". I need to access files in the "documents" folder and "template" folder now I have to put the full path. So if I move the main "Report folder" I need to change the path for the documents or template folder.
I am using Access 2000

8 replies

by pxttocyob

This is a new nifty feature programmed into the software to make your computing experience richer and more rewarding.

by lo

Humm, ...

Not sure where you are making the file access from, inside Access or from a Windows/DOS app (Win Explorer or a DOS window).

If you are doing programming from inside Access I think you can set up a variable that will allow you a single point of change to a directory path. Define a global, RootDev = "x:\" and concatenate that to all references (assumes standard structure (Report Folder has documents and template, etc. The other means of doing this is from and environment variable set prior to execution of the Access session. Same/similar to global above but you don't need to modify code to change (Win does this to get the Windows directory, WINNT or WINDOWS (kick of a DOS session and type SET ).

If you are in a window application I assume you have navagation windows to get around. I f you are in a DOS session, you have some options: 1) CD to the directory. You can do relative accessing from there, ..\ will reference up a level, from CD "Report folder", documents\ will reference that folder. 2) use DOSKEY, once you enter a directory, you can up arrow and modify adding or removing to get desired path.

For either you can probably define symbols (in setup or a .BAT file) for each directory, such as:
set dev=C:
set rptrt=%dev%\report folder
set docrt=%rptrt%\documents
set temprt=%rptrt%\template

Then you can use:
DIR %docrt%\
or
DEL %temprt%\A*.TXT

This works on my Win NT workstation, not sure about Win 9x (screwed mine up sometime back and haven't fixed yet).

Might post a comment as to exactly where you are trying to access the directory path from, also your OS.

by dennisbv

For answer Two what I am trying to do is to be able to move the folder containing the Access program and its sub directorys. Now every time I move the folder I have to change the code to point the new location.
Now the path would be (ServerName\Home\programing\Kohler report\Documents or Templates)
The program is in the folder Kohler report.
What I want to do is just have the path \documents or \Template
I hope This explains what I am trying to do

by sankulpune

Hello dbVeto,

Try using the 'FileSerch' object in Access 2000.

The following code finds all files in all the subdirectories in the "c:\Report" subdirectory and then displays the first file found by the search.

With FileSearch
.LookIn = "C:\kpcms"
.Filename = "*.*"
.SearchSubFolders = True
End With
FileSearch.Execute
MsgBox FileSearch.FoundFiles(1)

I hope this helps.

I would be glad to provide any more specific assistance you may need in this regard.

With best compliments,

SanganakSakha,
Simple And Effective Solutions To Small Problems, No QuickFixes.

This discussion is closed to new replies.