Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error trapping failing

31 views
Skip to first unread message

The Frog

unread,
May 12, 2013, 3:11:59 PM5/12/13
to
Hi everyone. I am having a problem that seems to resist logic. I am
using the html document parser from ms which is being passed an html
document retrieved by ie. Every so often I receive an automation
error when for some reason the document object doesn't exist. I trap
for this error, but my code never reaches the error trap! Instead it
hangs on an until statement which tests the content of the document
object and of course crashes because the object mysteriously doesn't
exist - stops on that line of code and never jumps to the error
handing! Standard normal on error statement at the start of the
function. Named error handler at the bottom of the code. Why would
the on error statement be ignored?

--
Cheers

The Frog

Phil

unread,
May 13, 2013, 4:25:41 AM5/13/13
to
If you can't find it, we lesser mortals don't stand much of a chance.

What's the code?

Phil

The Frog

unread,
May 13, 2013, 5:29:45 AM5/13/13
to
Hi Phil,

Think I figured out what the problem is. When using automation to control things or work with things you have to keep in mind the the object you are automating isnt always 'perfectly' written. In this case I have been re-cycling a single object for many tens of thousands of loop cycles and it just doesnt seem to be able to recover from that each and every time. I cant tell if there is a memory leak taking place at the same time.

The control that is causing the poblem is 'Microsoft HTML Object Library'. I am using it to parse some large amounts of HTML files. Eventually it crashes. Restart the application and it continues on with no errors at all. The reason I think the error trap is not working is that contol is never returned to Access to trap it! I cant prove that, but it is the only thing that seems to make any sense. When control is eventually returned to Access the error isnt being reported to access as an event it has to deal with so the error is never 'fired', Access remains ignorant of it, then the app just continues until it crashes because a dependant component is buggered.

What I am going to have to do is incorporate a second error check into the routine so that after the html document object is 'SET' to its new contents the application specifically checks for an error code instead of relying on the ON ERROR statement to work (which it certainly isnt). Manually disposing of the object and recreating it allows the application to continue unfettered. All I can guess is that it is one of those quirks that you just have to find out about the hard way as it sure as hell isnt in the documentation!

Do you need some help at all working with the HTML library? Its actually quite useful if you have to parse HTML files, makes your logic quite easy to follow for debugging and does a vastly superior job to using pure XML parsing or Regex. Right tool for the job, just a little unstable it seems. Manageable though. Can post some code if you like, just not sure its useful to anyone.

Cheers

The Frog
0 new messages