o
k
q
u
e
s
t
i
o
n
s
.
c
o
m

(SOLVED)Trapping Errors in a loop... -

Hi guys... I have a simple question to you...

I have the following code:

VB Code:
  1. For x= 1 To Combo.ListCount - 2
  2.     On Error GoTo ErrSec
  3.     If Not NotErrcnxBTE Then
  4.        Set DataBTE = New ADODB.Connection
  5.     Else
  6.        DataBTE.Close
  7.        NotErrcnxBTE = False
  8.     End If
  9.     Path2 = GetDBPath(Combo.List(x))
  10.     DataBTE.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  11.                  "Data Source=" + Path2 + ";" 
  12.     DataBTE.Open
  13.     NotErrcnxBTE = True
  14.     CompDB
  15. ErrSec:
  16.     Select Case Err.Number  ' Evaluate error number.
  17.        Case -2147467259 
  18.              FGRacklist.TextMatrix(UsedRows, 0) = Combo.List(x)
  19.              FGRacklist.TextMatrix(UsedRows, 1) = "No Se Pudo Conectar"
  20.        Case -2147217843
  21.              FGRacklist.TextMatrix(UsedRows, 0) = ComBTE(0).List(Btecount)
  22.              FGRacklist.TextMatrix(UsedRows, 1) = "Falló Autentificación"
  23.        Case Is <> 0
  24.              MsgBox Err.Description + CStr(Err.Number), vbCritical, "Error En Form Load"
  25.     End Select
  26.     Err.Clear
  27. Next x
The problem I have is that I'm able to trap the first error... but if I get another error this one raise the 'normal' run-time error instead of getting trapped...

So, I'm wondering if there is something I can do to trap all the errors...

Tnx!

 

Error trapping coding -
I want to know how you guys do error trapping... What if I got two private sub that need the same error trapping routine... I have to code the same trapping code on two subs. Is there a better way like one place can call trapping code in another sub. Thx


How to change error trapping -
In any given vb project, can you dynamically change from one type of error trapping to another? In other words, can you change from "Break on all errors" to "Break in class module" using code? The reason I ask is that I have a vb project that initially checks fo


Tracking and logging errors in code -
In a project I "inherited," there is little if any error trapping / recording. The project has about 25,000 lines of code. I was wondering if any of you wise folk out there might have a sample of code for error trapping and writing to an error log, or if you would kindly po


Error handling in general -
When I creating a program, I will typically do not include any OnError statements until the program is nearly finished. I do this primary to avoid the temptation of relying on error handling to do certain tasks. For example I could use error trapping make sure an integer generated fro


[2008] What's the best way to handle errors -
Hi Guys, What's the best way of trapping errors and displaying them on screen. Please advise


What are the errors shown for .net2003 programs in .net2005 -
Can someone tell me how efficient is the .net2003 to .net2005 converter? Is it giving any errors for your programs? I tried converting a vb.net program and i had no errors,but I did get errors for an asp.net program....and I was unable to solve it and ultimately i took .net2005 off my


Trapping Inet Errors!! -
Hi! Anyone know how to trap errors from the Inet control?? I want to trap for exampel IncorrectPassword and Incorrect user. I know how to write a errhandler, but the problem is when I try to fake an error by enter the wrong password or username it only returns the error 35754 Una


VB6.exe has generated errors an error log is being created -
VB6.exe has generated errors an error log is being created. There was a thread on this but the question was never answered. Where is the log file being generated? I can't find it. Also does anyone know what may be causing this problem? I am running Win2k and SP5. I've tried trapp


SOLVED - Handling errors in a Class - Thanks Everyone! -
OK, with the help of some users here, I have finished my first class. Now, I have been going back and forth on how to handle errors....first I started putting in error handling in each function, sub, and property of the class.... But then I thought, wouldn't it be better to have


Trapping errors. Please help -
Hi, I am trying to execute BCP out by using the Shell function in VB. How can I trap the error messages returned by BCP command? I would appreciate if you guys can help me out on this. Regards, GV


Proramatically remove lines of code -
In this $#@$$ project I have "inherited," there are some lines of code that repeat themselves in every single function, subroutine and module that I want to get rid of.... actually, they're code for an old fashioned way of doing some error trapping. I want to get rid of them


vba error trapping for classes and forms -
with modules you can set up the error trapping code in the first module and it's valid for all subsequent modules. unfortunately the same is not true of forms and classes which appear to require error trapping code in every procedure within them. is there any way round this?


Global Error Trapping -
I made a UDT for errors, and i stuck in a new form. My goal here is when a user gets an error ANYWHERE in the program, it will go through and put in the info for the UDT, then run the new form displaying that info along with a description box for the user to describe what happened w


trapping help buttons from message boxes -
Respected Sir, My name is D.N.Rajesh from Bangalore.I am under training in vb6.0.I am doing a project known as "Student Information" In that Project I am trapping the errors & diplaying the userdefined message through the message boxes. In


trapping the arrow keys -
I need to know when an arrow key has been pressed but I can't locate the code to use for trapping them.


error trapping -
Hey, can someone give me the simplest example of error trapping? if there is no simple example, no prob. thanks


on error / resume -
I have this bit of code: With objXLS .Workbooks.Open spreadsheetname Dim cell As Object For lng = 2 To 10000 Cells(lng, 20).Select For Each cell In Selection cell.Value = "'" & cell.Value Next Next the loop is going through the c


Error trapping in VB sucks -
Exit Sub is such a dumb way to do error trapping. Exceptions are infintely better.


Error trapping problem -
Hi I have made a 'database corruption utility' tool for our customers to use to determine which records in a specific table are corrupted (as happens often with access). My program creates a temporary table in a new database, and copies all data from the source table to the new one


safe recovery from broken connections -
At my place of work we write our own software using VB 6/SQL Server. Our network is fairly reliable though occasionally our VB apps lose the database connection while running, giving lost connection errors. Error trapping would catch the error but what would be ideal would be when t


loops interacting with screensaver -
When I run a loop with my .NET project that's lengthy enough for the screensaver to be triggered, the screensaver interacts with the loop. I can't get the screen back clearly until the task involving the loop is finished. I understand that 'For Events' solved this problem with VB6,


Key Trapping in a Textbox. -
Hello, I have a Textbox on a form that I type text into, I need the 'Return' and 'Enter' keys on the keyboard to be disabled when entering text. I know using key trapping will work but I am not sure how to code it, Any ideas, SKM.


trapping mouse in picture box -
How would i go about trapping the mouse inside the picture box that i am drawing a line in? I have absolutely no idea how to do this. If someone could give me some pointers i would really appreciate this.


error trapping question -
how does VB error trapping work?


A simple Score system -
I have justed started VB coding with the help of a few books. I was hoping to implement a scoring system in the game that I have design. If anyone is able to start the code for me it would be extremely helpful. At the end of the game when the "game over" message is displa


Stripping Single Quotes From An Error Message -
I'm using SQL Server 2000. I have an Errors Log table set up, and in my Error Trapping, I'm writing Err.Number & Err.Description (as well as a variety of other things) back to the errors log table. This all works fine and dandy except on errors generated by SQL Server...speci


VB Error Traps Don't Work -
None of my error traps seem to work in VB6-Enterprise. When I raise any errors, my On Error routines are never called. All I get is the generic VB error box with the END and DEBUG buttons. I tried using VB's Errors Project as a sure-fire test, but I get the same result. I have tried


Trapping arrow keys -
Hi Andrew, Try trapping the on the KeyDown Event of your Control. Private Sub lstOrderNo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyDown Then MsgBox "Hey YOu!" End If End Sub ThoMas.


On Error ---Error (RESOLVED) -
Hi I have an application that cycles through about 50 remote MSDE databases, to download data, problem is, sometimes the machines are on, and sometimes not, and the whole comms area is a bit flaky. I put 'on error' trapping in the pgm with 'err.reset' and this handles the first non


How to stop ComException errors when you close a form, and a com is still executing -
When i close a form, and a webbrowser is navigating (or i have a do:doevents:loop until wb.busy = false loop), i get comexception errors up the wazoo. how can i stop these? is there anyway to unload certain compunents on form_queryunload?


trapping a right click of a column header -
Here's the 911: I need to trap the right click of a columnheader in a control that inherits from Listview. I realize this means overriding the WndProc method and trapping the WM_Notify, which in turn needs to be converted to a NMHDR structure. However, i am having problems with


SQL DMO/ Error Trapping. -
I am using SQL DMO in an app that I am currently developing and have come across a problem trapping an error. The error is coming from SQL not my app, things like invalid user name or password. Because the error is coming from SQL my usual error handling routine is not working. Could s


trapping Excel errors -
I'm trying to use something like Code: On Error GoTo ErrorHandler lastindex = myExcel.Sheets("Sheet 1").Cells(4, 4).Value but it does not go to errorhandler, but pops up a dialog stating the error. How do I trap excel errors?


File System Object - error trapping -
When using the file system object to copy, move, and delete... I would like to capture any errors that occur during the process. I can't seem to find any literature about the errors generated during a copy or delete. For instance, if the file could not be copied to a destination fold


404 errors on local host -
Hey all just wondering if its surposed to be like this or not, i have error trapping turned on for 404s i i access my website on local machine like http://localhost if i put http://localhost/test which would be a folder however the folder doesnt exist and i get a standard 404 not fou


runtime label caption change in a loop - Solved -
I am trying to give captions to labels(more than 10) during runtime that too in a loop command mode. how to change labelno during loop? my labels are named like Lable1,Label2... upto 20. Label1 should change to Label2 and so on.


Drive Ready -
Can anyone tell me how to determine if the floppy drive is ready using VB code. Or could someone tell me why i can only trap one instance of an error in a loop. eg My program looks to see if the a drive exists, in the case of the floppy drive however it always exists so i am trappin


How to trapping the F1 key in IE/ActiveX -
I have an ActiveX application that has content sensitive help. My problem is preventing IE's help from displaying when F1 is pressed. When the application is running in the browser and a control in the app has the focus pressing the F1 key displays both the application's help topic a


Trapping MouseMove in Third Party App -
Hello, I was wondering if anyone can help me out with trapping the mouse movements in a third party application. I would like to find out when the mouse is being moved in the third party application and what the coordinates are when it is being moved. I believe I need to use the


error-trapping help -
hi all, could anyone advise me as to the best way to add a error-trapping procedure to a program im writing. (new to vb) i want it to show a message if a user tries to open a file that no longer exists in either the open procedure of a common dialog or a recent file menu optio