[AccessD] Cool stuff - was RE: using a dtsx in .Net

Gustav Brock Gustav at cactus.dk
Sun Apr 22 05:01:04 CDT 2007


Hi John

It's worse. It has only limited functionality.
Quoting myself from 2002-02-19 where Jürgen had brought up how to use FindFirstChangeNotification:

<quote>
The problem I have with this is that it does not seem to be very
accurate. If a bunch of small files are copied then the event fires only
a couple of times; thus - for accurate purposes - it may be necessary to
regard the event being fired when "something" has happened - then you
have to investigate what this something is. Of course, if a file is
dropped in the watched directory only once in a while, this is not
necessary.

Any suggestions from the API gurus are most welcome.
</quote>

No suggestions were posted, so somehow this task must be very difficult ...

/gustav

>>> jwcolby at colbyconsulting.com 21-04-2007 21:37 >>>
Thanks for that.  I just checked out this solution and while it does
function, it appears to have some serious limitations, specifically that it
can only monitor one directory, and apparently that it can pretty much do
nothing else.  The reason is that VBA is single threaded, and this code is a
tight loop with a DoEvents to allow the appearance of normalcy.  However it
really doesn't allow anything else to function.  I tried to make this a
class so that I could then do two (or more) instances.  The first instance
starts up but the second instance is not allowed to instantiate, with a "the
macro or validation rule prevents..." error thrown in the event of the text
box that tries to set up the second instance.  In essence it appears that
this would work just fine in limited situations where you just want an
application to monitor a directory, do something specific, then go right
back to the monitor loop, however it may completely prevent a broader
application from functioning after the loop is started.

One of the things I am trying to do is to start slowly doing some VB.Net
development.  I have a handful of things that really don't "fit" Access as a
development tool, e.g. running things as services.  I am also doing a lot
more stuff directly out in SQL Server 2005, and I want the ability to run a
powerful programming language that more directly talks to SQL Server, and
also does not require a copy of Access installed in order to operate.
VB.Net will give me that if I can ever get it figured out (I just need the
TIME!).  

The .Net code basically listens for EVENTS from a DotNet DiskWatcher object.
I haven't gotten so far as to determine whether when wrapped as a COM object
it can be used more than once from inside of Access.  The Web Seminar left
out the critical (written) instructions for compiling and registering the
com object, though the instructions are in the video, so I am headed back to
watch that portion of the video again.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MartyConnelly
Sent: Saturday, April 21, 2007 1:31 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Cool stuff - was RE: using a dtsx in .Net

You could use these Visual Basic 6.0  File API Routines
in VBA     FindFirstChangeNotification:
Randy Birch does a good job on error checking

Might have to run in a hidden form

   Create a 'Watched' Folder

http://vbnet.mvps.org/index.html?code/fileapi/watchedfolder.htm 


JWColby wrote:

>ROTFL.  Yea, I kinda thought so.
>
>I have so little patience with ...  uh...  Stupidity.
>
>On another more positive note, I watched a virtual lab tonight - part 
>of the Visual Studio 2005.  This lab is "using worker threads in VB.Net 
>to make your application more responsive to the user".  It is really 
>cool, but as it turns out, the demo they use is also exactly what I was 
>looking for - a directory watcher which is a com object that can be 
>used from VB6.  Now to be honest, I don't do VB6 but it looks like this 
>might also be usable from VBA.  It is a referencable object that 
>sources events, and may allow me to do directory watching from inside 
>of Access - WITHOUT having to use a timer on a form.  How cool would that
be?
>
>VB.Net is really a cool thing; Too bad I don't understand it better.  I 
>have to say though that having done the class stuff I do in Access, I 
>absolutely do understand everything they are talking about in this 
>demo, I just don't understand all the syntax (couldn't write it 
>myself).  It is so strange though, just today I was looking for code to
"watch a directory for files"
>and here it is.  Even better, the lab counts towards getting the free 
>copy of Visual Studio 2005.
>
>So much to learn, so little time.
>
>John W. Colby
>Colby Consulting
>www.ColbyConsulting.com 





More information about the AccessD mailing list