Re: Access VBA crashes silently

From: Douglas J. Steele (NOSPAM_djsteele_at_NOSPAM_canada.com)
Date: 03/25/05


Date: Fri, 25 Mar 2005 14:35:32 -0500

Don't know whether it's a cause of the problem, but there is no
ADODB.Application object.

Does the file to be deleted exist? Try:

 If Len(Dir("c:\test.txt"))>0 Then
    Kill "c:\test.txt"
 End If

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Cruachan" <gis@slovakrail.com> wrote in message 
news:1111777943.333039.165070@l41g2000cwc.googlegroups.com...
>I have an Access database running on Windows XP which seems to have a
> corrupted VBA environment, but I can't seem to get a handle on what's
> gone wrong.  Any pointers would be appreciated.
>
> The system has Office XP (2002) with Office SP3 installed running on a
> new installation of XP with SP2 applied.
>
> Everything initially ran fine, but after the my client had been running
> the application for few days it started crashing with 'Access has
> encountered an error and has to close' but no further details.
> Stepping through the code revealed that the system could crash at a
> couple of points (there are probably others) -
>
> CreateObject("ADODB.application")
>
> and
>
> Kill <some filename>
>
> In both cases the debugger would step into the line of code and then
> stop.  Interesting in the debugger the system didn't produce an error,
> just silently stop running.  This was not a hang - the system is
> still
> responsive - it just drops out of running any code at that point.
>
> To confirm I created a small sample database with one form and a button
> linked to the lines of code
>
> MsgBox "Before Kill"
> Kill "c:\test.txt"
> MsgBox "After Kill"
>
> This time the database ran both in and outside the debugger, but never
> displayed the second message in either case - i.e. it is silently
> crashing at the kill statement (the file is not removed).  I can run
> the database across the network on another machine and it all works
> fine, so it isn't Access itself which is corrupted.
>
> A comparison of the VBA references reveals no differences from a
> similar machine where the system is still working.
>
> The only changes that have happened between the application being
> installed, when it worked correctly, and now is that a number of MS
> hotfixes have been applied by MS Update, and the client has installed
> another small application put together by someone in-house.  This other
> application appears to have been written in VB6, and the suspicion is
> that this installation (using a VB6 created install we believe) has
> corrupted the VBA environment.  However removing the other application
> and reinstalling our application does not have any effect.  Indeed
> we've gone so far as to unregister all dlls in the other applications
> setup.lst file (except the ole dll) and ensure that all it's copies of
> any files it installed have been removed.
>
> Interesting there are another couple of boxes which are running our
> application where the VB6 application was installed first, and these
> appear to work fine.  Also our application didn't stop working until a
> day or two after the VB6 application was installed, but that may be
> because no reboot was applied before then.
>
> I've searched usenet and MS for an answer, but without an error message
> it's difficult to find anything.  Any help would be much appreciated.
>
> Kevin
>