Solved

Tracking any line of code that throws an error.

Posted on 2004-08-05
6
193 Views
Last Modified: 2012-05-05
Is there a way in VB6 to know exactly what line of code errored when the error handling is called?

Does VB track the line it is executing in a variable or something while it is processing. Something like a variable called strCodeExecuting that whenever on error is encountered I can write the variable out and know exactrly the line of code that was trying to be executed?

I want to keep a log of all errors, clients do not always tell me what the actual error was, or all the errors for that matter.

Thanks,
Mike
0
Comment
Question by:MGC22
  • 3
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
bkthompson2112 earned 50 total points
ID: 11729280
Hi MGC22,

You can use the undocumented erl() function to display the line number in your error log.

See here: http://www.awprofessional.com/articles/article.asp?p=25180

bkt
0
 
LVL 18

Assisted Solution

by:JR2003
JR2003 earned 50 total points
ID: 11730170
NB: To use the erl function you have to number all you lines of code
0
 

Author Comment

by:MGC22
ID: 11730215
I was hoping for the actual text of the line but the line number could work.
As JR2003 mentions about the line numbers, is there a way to automate putting in the line numbers in VB6?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 18

Expert Comment

by:JR2003
ID: 11742139
The source code for a vb add-in to add line numbers to code is here:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=49876&lngWId=1
0
 
LVL 18

Expert Comment

by:JR2003
ID: 11742143
In fact here's a better one and it's freeware!

www.mztools.com 
0
 
LVL 6

Expert Comment

by:bkthompson2112
ID: 11906803
Thanks :)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to skip loop 6 56
Updates not working for MS Windows 7 12 164
Copy a row 12 61
Error with a code discussed on this page 5 12
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now