[AccessD] Code forgets error handlers?

Heenan, Lambert Lambert.Heenan at AIG.com
Wed Feb 9 11:12:33 CST 2005


Without seeing the code it's hard to be sure what's going on. But one small
suggestion, would 

On Error Resume Next

work any better? Of course it depends on what comes after the Dir() line.

BTW, here is my "is it a directory" function...

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

This does not error out when looking at a folder to which I have no access.
Instead it just returns True.

Lambert

> -----Original Message-----
> From:	accessd-bounces at databaseadvisors.com
> [SMTP:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
> Sent:	Wednesday, February 09, 2005 11:53 AM
> To:	accessd at databaseadvisors.com
> Subject:	[AccessD] Code forgets error handlers?
> 
> Hello All,
> 
> The recent thread about selecting directories made me break out a tool I 
> used to find all folders and subfolders on a drive...and then find all
> files 
> of a certain type in those folders.  The problem I ran into as the code
> was 
> looping through was when it used the Dir() function to determine if it was
> a 
> directory...and it turned out to be protected or I didn't have access to
> it. 
>   I would get an error that the path did not exist.  So I put in error 
> handlers...On Error GOTO "skip"...just something to goto the next record.
> 
> This works fine...but after a couple hundred loops...the code 'forgets' 
> about the GOTO and just gives me the error.  This is A97 on a NT machine.
> I 
> thought I might be missing something because it was a loop...I even put
> the 
> GOTO at the beginning and end of loop and function...Any ideas?
> 
> Thanks,
> 
> Mark
> 
> 
> -- 
> 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