By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

On Error happening all the time

P: 80
Recently, I've rolled out an app to several users, some of whom don't have access on their computers (using runtimes libs instead). I'm trying to track down what the error is, so I put in an "On Error" statement in a likely place in the form. The code grabs the username from environment and the error code, and sends an e-mail to me with the error number. However, it executes every time, regardless of whether there's an error or not. I basically get e-mails with a value of "0" for the error.

What am I missing?
Aug 26 '08 #1
Share this Question
Share on Google+
4 Replies


Megalog
Expert 100+
P: 378
Can you post one of your subroutines so we can verify that the error is being trapped correctly?

As far as a fix, you could insert a simple check in your error trap section like:

Expand|Select|Wrap|Line Numbers
  1. PrivateSub_Error:
  2.     If Err.Number <> 0 Then
  3.        <<call your email function>>
  4.     End If
  5.  
  6. End Sub
Aug 26 '08 #2

missinglinq
Expert 2.5K+
P: 3,532
As Megalog insinuated, it's difficult for us to troubleshoot your code unless we can see it!

Linq ;0)>
Aug 26 '08 #3

P: 80
Thanks for the replies, but I found the problem. I didn't have "Exit Sub" before my error handling routine, so even if the code was executing successfully, it was getting to the eh routine and running that code afterwards.
Aug 26 '08 #4

missinglinq
Expert 2.5K+
P: 3,532
In other words, Access was doing exactly what you told it to do! Don't you just hate it when that happens? LOL!

Glad you figured it out, and thanks for posting the solution back to us!

Linq ;0)>
Aug 26 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.