[AccessD] A2203: Determine if a folder exists

Heenan, Lambert Lambert.Heenan at AIG.com
Tue Mar 22 08:37:12 CST 2005


So many replies! So many differing approaches! So many references that need
to be set!

Not if you use this simple, effecting, all VBA solution...

Function isDirectory(sDir As String) As Boolean
    On Error Resume Next
    isDirectory = (GetAttr(sDir) And vbDirectory) <> 0
    If Err.Number <> 0 Then isDirectory = False
    On Error GoTo 0
End Function

Lambert

> -----Original Message-----
> From:	accessd-bounces at databaseadvisors.com
> [SMTP:accessd-bounces at databaseadvisors.com] On Behalf Of Darren DICK
> Sent:	Monday, March 21, 2005 9:01 PM
> To:	'Access Developers discussion and problem solving'
> Subject:	[AccessD] A2203: Determine if a folder exists
> 
> Hello all
> This should be simple but it's causing me pain
> I have a folder (It does exist)
> C:\SomeFolder\SomeSubFolder\TheDestination
> 
> If I type the following code and 'run' it
> 
> If IsNull(Dir(Me.PathToDownloadTo)) Or Dir(Me.PathToDownloadTo) = "" Then
>         MsgBox "Folder Doesn't Exist"
>     Else
>         MsgBox "Folder exists"
>     End If
> 
> It still tells me the folder doesn't exist even though it does
> 
> What is a 'proper' way to tell if a folder exists
> 
> Many thanks in advance
> 
> Darren
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list