Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Verifying the existence of a directory

Status
Not open for further replies.

chell

Programmer
Oct 26, 2000
30
US
Hello;

I'm writing an app in Access VBA and I need to verify the existence of a directory as supplied by the user. The DIR function works fine except that it won't work with something like "\\Server1\ADirectory". Does anybody have any ideas?

Thanks For The Help...
Chell
 
Use the Dir() function. If the directory is supposed to have files, it is real easy:
Code:
If Dir(&quot;\\Server1\ADirectory\*.*&quot;) <> &quot;&quot; Then
    'Files Are Present
Else
    'No Files
End If
If this directory can be empty, it will take a little more code. If this is the case, look into the Help for this function, or let me know and I will get to it when I have more time.
 
You can also enable the Microsoft scripting reference commands and give you all the DOS type commands like copy etc
 
Try If Dir(&quot;\\Server1\ADirectory&quot;, vbDirectory)<>&quot;&quot; Then
'Directory exist
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top