error handler does not handle the same error more then once

J

J Miller

I have the following code and error checking routine in my program:

===================================
Sub Test()

On Error GoTo tagErrorTrap

DBngine.CompactDatabase FILEA, FILEB
DBngine.CompactDatabase FILEC, FILED

Exit Sub

tagErrorTrap:
Select Case Err.Number
Case 3358 'database opened
Resume Next
Case Else
Msgbox Err.Number
Stop
End Select

End Sub
===================================

What is happening is the first time a specific error is encountered
the routine kicks in, handles it, and it works fine. But if the same
error occurs again in the program the routine is ignored like it
doesn't exist and my program is blowing up because the error is not
being handled.

In the code above if FILEA is opened the error handler works fine and
passes control to the next line, but then if FILEC is opened I get a
hard 3358 error because the error routine didn't do anything.

What am I doing wrong? Does something need to be reset??


Thanks in advance.


Jeff
 
M

Matthew Sullivan

Is that the actual code? "DBngine" shouldn't even compile. And I
show that the "file opened" error code is 3356, not 3358 (in Access
97).

When I make those fixes and test it, the error-handler works as it
should.

-Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top