Error Code assistance

Posted on 2006-07-14
Last Modified: 2010-04-30
VS6 SP5,

Have a form that employees fill out and then click submit button to email the contents of their
request to a manager, problem is if they forget to select who there manager is from combo2.text
it errors out and they loose everything else in the form they have already entered...I need error
control that will stop in the event of an error and allow the user time to select a manager
and continue with the submit button....Please help..

On Error GoTo err5
Select Case Combo2.Text
          Case Is = "user1", "user2", "user3", "user4"
          Case Else
          MsgBox "You are required to select a manager to send the request to!"
End Select

The Err.Clear above still alows the rest of my code to run...

More code that send email confirmation....
Question by:ittechie100
  • 3
LVL 11

Expert Comment

ID: 17111386
Have you tried putting an "exit sub" in the error handler??
LVL 11

Accepted Solution

leclairm earned 125 total points
ID: 17111417
Actually something more like :

Select Case Combo2.Text
          Case Is = "user1", "user2", "user3", "user4"
          Case Else
          MsgBox "You are required to select a manager to send the request to!"
          exit sub ' or exit function
End Select

Author Comment

ID: 17111449
Thank you..Sorry for something so small, however I've never taken any programming classes, learning as I go...

LVL 11

Expert Comment

ID: 17124957
Thanks for the points and good luck with your learning process.

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 40
How to incorporate an error traping routing to existing code in VB6 11 40
MsgBox 4 61
how to Classify of email (pdf attachments) 7 36
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

773 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