Results 1 to 5 of 5

Thread: How to run another form on error

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    1

    How to run another form on error

    I want to develope a form which call another form if any error occures

    i am developing an application in which if first form dont get data from database then on error it call another data entry form and enters data to database and again start running first form from last resumed point


    can anybody has idea , how can i do this?

    code will help a lot

    Thanks

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: How to run another form on error

    Thread moved from CodeBank forum (which is for code examples, not questions)

    Welcome to VBForums

    To do that you will need to have an error handler, see our Classic VB FAQ's (link in my signature) for an explanation of how to do that. You would then simply have code like: Form2.Show

    It would be better tho to avoid the error in the first place.. if you show us your code, we can give you much better suggestions.

  3. #3
    Fanatic Member amrita's Avatar
    Join Date
    Jan 2007
    Location
    Orissa,India
    Posts
    888

    Re: How to run another form on error

    In form 1 write

    If (no data found)
    Goto jumpToForm2
    Else
    End if
    Exit sub
    jumpToForm2:
    Form2.Show

    In form2 after inserting data unload the form2.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: How to run another form on error



    That does exactly the same thing as the following (which is much easier to read):
    vb Code:
    1. If (no data found) Then
    2.   Form2.Show
    3. Else
    4.   'other code here?
    5. End if
    ..as I mentioned above tho, we need to know more to be able to give a proper answer.

  5. #5
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Re: How to run another form on error

    And unless you are coding an Error Trap, forget GoTo exists.
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width