[AccessD] A Matter of Killing

Max Wanadoo max.wanadoo at gmail.com
Sun Aug 16 10:38:51 CDT 2009


Well, of course, you do realise it wasn't MY idea. LOL

When I first started out I avidly read Herts and Gerts or whatever they were
called.  

Lost the books long ago, but fantastic 2 x volume set on programming MS
Access.

In there, they advocated deliberately testing the error, trapping for it and
handling it as a neat quick way of finding  out "Is it there yes or no".

I have been doing it every since.

It normally continues with something like this (again, using the Kill as an
example)

On error resume next
Kill file
If error.no <> 0 then
It wasn't there - so we might want to do something here
Else
It was there and we killed it and might want to do something here
End if

If you wanted to take action following the kill statement.

Just an example.

Max


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mike Mattys
Sent: 16 August 2009 16:24
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A Matter of Killing

Hi Max,

I agree. There are plenty of ways to accomplish whatever
you're programming and using errors to your advantage
is just plain creative. It all depends upon what you're doing ...

Private Function FileExists(ByVal inFile As String) As Boolean
    On Error Resume Next
    FileExists = CBool(FileLen(inFile) + 1)
End Function

-
Michael R Mattys
MapPoint and Database Dev
www.mattysconsulting.com
-
----- Original Message ----- 
From: "Max Wanadoo" <max.wanadoo at gmail.com>
To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
Sent: Sunday, August 16, 2009 10:52 AM
Subject: Re: [AccessD] A Matter of Killing


> Not necessary to test for file size or do a DIR() or any of the other
> cumbersome ways.
>
> Simple code is always best.
>
> 1. Kill it.
> 2, If it isn't there, trap the error and move on.
> 3. If it is there, it gets killed.
> 4. Either way we move on.
>
> Simple, elegant, efficient and within the design parameters of MS Access.
> Oh, and easily understood with subsequent reading without the need to 
> write
> explanatory notes.
>
> IMO of course.
>
> Max

-- 
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