473,513 Members | 8,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error handling problem

4 New Member
Hi all,

I've been away from Access error handling for a while, and now that I've returned I can't figure out what I'm doing wrong here.

The following code doesn't pick up the error when there is one.
Expand|Select|Wrap|Line Numbers
  1. On Error GoTo error_handler:
  2.  
  3. 'Code here
  4.  
  5. Exit Sub
  6.  
  7. error_handler:
  8.     Call errorhandler(Err.Number, Err.Description, Me.Name, "Search_Click")
  9. End Sub
But if I move the goto to the following line after a resume next, it works fine.

Expand|Select|Wrap|Line Numbers
  1. On Error Resume Next
  2. GoTo error_handler:
  3.  
  4. 'Code here
  5.  
  6. Exit Sub
  7.  
  8. error_handler:
  9.     Call errorhandler(Err.Number, Err.Description, Me.Name, "Search_Click")
  10. End Sub
What am I missing here?

Thanks
Robin
Oct 31 '08 #1
5 1892
emsik1001
93 New Member
Hi

Try removing :

so instead
On Error GoTo error_handler:

Try
On Error GoTo error_handler

I hope it helps
Emil
Oct 31 '08 #2
Rghertner
4 New Member
Thanks for the response, and sorry for the delay. I tried removing the colon, but no luck. Still doesn't catch the error.
Nov 3 '08 #3
PianoMan64
374 Recognized Expert Contributor
Thanks for the response, and sorry for the delay. I tried removing the colon, but no luck. Still doesn't catch the error.
Do you have a subroutine that isn't part of the current module that is not valid, that it is stuck in a loop?

Not sure, but just guessing since there isn't anything showing the sub call that you do inside the error message?

Just a thought,

Joe P.
Nov 3 '08 #4
NeoPa
32,557 Recognized Expert Moderator MVP
In your second version going to the error handler works, but it doesn't appear to be dependent on hitting any error. It will go there in ALL circumstances.
Nov 14 '08 #5
NeoPa
32,557 Recognized Expert Moderator MVP
Robin,

Have you actually compiled this code at all? It seems to have some basic errors in it (I'm referring to the obvious one of having a ":" in a GoTo statement.

It may fail to catch this as it's also used as a command separator within a single line, but it's wrong nevertheless and compiling code before posting is ALWAYS a good idea.
Nov 14 '08 #6

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

Similar topics

6
8438
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order...
13
4434
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
21
4372
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So...
1
9907
by: Metal Dave | last post by:
I do not understand the error handling of SQL Server here. Any error in bulk insert seems to halt the current T-SQL statement entirely, rendering it impossible to log an error. The first statement...
33
3107
by: Anthony England | last post by:
I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on...
10
2268
by: Anthony England | last post by:
(sorry for the likely repost, but it is still not showing on my news server and after that much typing, I don't want to lose it) I am considering general error handling routines and have...
5
1718
by: csgraham74 | last post by:
Hi guys, Basically i have been developing in dotnet for a couple of years but ive had a few issues in regards to error handling. For example - I have a class that i call passing in a stored...
35
3738
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks...
5
2798
by: adam.timberlake | last post by:
I've just finished reading the article below which goes into some depth about exceptions. The article was rather lucid and so I understand how to implement it all, the thing I'm having trouble with...
2
1866
by: Omar Abid | last post by:
Reason of this project: Error handling is one of the most difficult thing that may afford a programmer. It isn't as easy as you think and handling errors in a program some time can make errors...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.