Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB run-time error 91

Posted on 2003-12-02
4
Medium Priority
?
972 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 90 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

604 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