470,612 Members | 2,365 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,612 developers. It's quick & easy.

On Error ... Fails! - Any suggestions

Hi,

I've got some code which uses various "On Error" statements to try to trap
some errors in VB6. When I try it on one machine (WinXP SP1) it works fine,
but on another machine (WinXP SP2) it fails to trap the error and so the
code fails. e.g.
On Error Resume Next
debug.print 3/0

Would fail on the "debug" line.

On Error Goto Fred
debug.print 3/0
Fred:

would also fail on the "debug" line

Any suggestions??

Without this basic error trapping the whole application is screwed.

Thanks

Andy
Jul 17 '05 #1
3 3812

"Andy" <a@a.com> wrote in message
news:d6**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Hi,

I've got some code which uses various "On Error" statements to try to trap
some errors in VB6. When I try it on one machine (WinXP SP1) it works fine,
but on another machine (WinXP SP2) it fails to trap the error and so the
code fails. e.g.
On Error Resume Next
debug.print 3/0

Would fail on the "debug" line.


Right click on your code somewhere, choose Toggle, and select "Break on
Unhandled Errors".
Jul 17 '05 #2

"Andy" <a@a.com> wrote in message
news:d6**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Hi,

I've got some code which uses various "On Error" statements to try to trap
some errors in VB6. When I try it on one machine (WinXP SP1) it works fine, but on another machine (WinXP SP2) it fails to trap the error and so the
code fails. e.g.
On Error Resume Next
debug.print 3/0

Would fail on the "debug" line.

On Error Goto Fred
debug.print 3/0
Fred:

would also fail on the "debug" line

Any suggestions??

Without this basic error trapping the whole application is screwed.

Thanks

Andy


I believe the debug.print would be outside your program scope. Does it
handle it correctly if you do:

On Error Resume Next
x = 3/0
Debug.Print "The error handler worked"
Jul 17 '05 #3
That solved it - after all these years with vb, I'd never had the need to
use that option.

Thanks

Andy
"Steve Gerrard" <my********@comcast.net> wrote in message
news:0L********************@comcast.com...

"Andy" <a@a.com> wrote in message
news:d6**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Hi,

I've got some code which uses various "On Error" statements to try to trap some errors in VB6. When I try it on one machine (WinXP SP1) it works fine, but on another machine (WinXP SP2) it fails to trap the error and so the
code fails. e.g.
On Error Resume Next
debug.print 3/0

Would fail on the "debug" line.


Right click on your code somewhere, choose Toggle, and select "Break on
Unhandled Errors".

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by fabrizio.blanco | last post: by
3 posts views Thread by Alberto Giménez | last post: by
3 posts views Thread by Antoine | last post: by
2 posts views Thread by Nigel Frost | last post: by
3 posts views Thread by Gary Varga | last post: by
669 posts views Thread by Xah Lee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.