Solved

VB run-time error 91

Posted on 2003-12-02
4
970 Views
Last Modified: 2011-09-20
I sometime have run-time error 91 in my VB application if I click thing too fast. When I click "OK" button it then shut down my application.  Is there a way to ignore the error 91 or trap the error somehow...

I really appreciate any help
thanks,
Majusri
0
Comment
Question by:Majusri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 9862013
Hi Majusri,
It always pays to have error handling in all of your procedures.

After your sub or function statment, have a statement that says
On Error goto Error

At the end of the procedure have something like this:

Exit Sub 'So that if everything went OK, the error handling is skipped

Error:
      MsgBox "An Error has occured. " & Err.Description
      'Add code here to ask if the user wants to continue or not
      If the user wants to continue then
            Resume Next 'Program will continue with the statement after the one that caused the error
      Else
            End 'Shut down program
      End IF
End Sub (or Function)

Dabas
0
 

Author Comment

by:Majusri
ID: 9862085
well then I can use on Error Resume Next.... somehow, I only get the error 91 one in a while, not all the time. when there is an error 91 then the application going to shut down. I don't know if it a problem between VB6 and SQL Server 2000 returning the data or if I clicking too fast. All I want to do is to ignore the error 91.


thanks,
Majusri
0
 
LVL 27

Accepted Solution

by:
Dabas earned 30 total points
ID: 9862108
Majusri,
Yes, you can use ON error resume next.
Only then you do not know what errors you are getting and you might get yourself into dangerous waters!
If you are error handling the application should not shut down.

Dabas
0
 

Author Comment

by:Majusri
ID: 9862159
Thank you for your tip. I will now have to implement on Error... on most of my sub.

Thanks Dabas.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

724 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