Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Runtime error 3021

burgiburgi Posts: 79Member
Hello folks!

Just to let you know I've nearly finished my program (the one with evil DBs/SQL in it). I am currently in the testing stage and while throwing test data at it I got a "runtime error 3021". I discovered this was when data that isn't in my DB.

Any suggestions on how to correct this?

I want to have a MsgBox popup and say something like:

MsgBox "Invalid postal code. Please check and try again."

(obiviously that bit is easy)

Thanks

John

PS: apologies about the speeling, i've done nothing but code for the last 5 days and am now exhausted :]

John
Geek and proud :]
www.geekandproud.co.uk

Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : Hello folks!
    :
    : Just to let you know I've nearly finished my program (the one with evil DBs/SQL in it). I am currently in the testing stage and while throwing test data at it I got a "runtime error 3021". I discovered this was when data that isn't in my DB.
    :
    : Any suggestions on how to correct this?
    :
    : I want to have a MsgBox popup and say something like:
    :
    : MsgBox "Invalid postal code. Please check and try again."
    :
    : (obiviously that bit is easy)
    :
    : Thanks
    :
    : John
    :
    : PS: apologies about the speeling, i've done nothing but code for the last 5 days and am now exhausted :]
    :
    : John
    : Geek and proud :]
    : www.geekandproud.co.uk
    :

    Hope your exhausted mind has room left for one little new statement:

    On Error Resume Next
    This tells VB to proceed to the next line of code when an error occurs.

    On Error GoTo LABEL
    This will jump to a specific 'label' in your code. Definition:
    MyGoodOldLabel:

    On Error GoTo 0
    Reset the error checking to VB's standard.

    Note... for this error checking to work in the IDE (when running it in the development environment) you (might) need to adjust some settings. Go to Tools->Options, Tab General, set it to Break On Unhandled Errors or on Break in Class Module

    Greets...
    Richard

  • burgiburgi Posts: 79Member
    : : Hello folks!
    : :
    : : Just to let you know I've nearly finished my program (the one with evil DBs/SQL in it). I am currently in the testing stage and while throwing test data at it I got a "runtime error 3021". I discovered this was when data that isn't in my DB.
    : :
    : : Any suggestions on how to correct this?
    : :
    : : I want to have a MsgBox popup and say something like:
    : :
    : : MsgBox "Invalid postal code. Please check and try again."
    : :
    : : (obiviously that bit is easy)
    : :
    : : Thanks
    : :
    : : John
    : :
    : : PS: apologies about the speeling, i've done nothing but code for the last 5 days and am now exhausted :]
    : :
    : : John
    : : Geek and proud :]
    : : www.geekandproud.co.uk
    : :
    :
    : Hope your exhausted mind has room left for one little new statement:
    :
    : On Error Resume Next
    : This tells VB to proceed to the next line of code when an error occurs.
    :
    : On Error GoTo LABEL
    : This will jump to a specific 'label' in your code. Definition:
    : MyGoodOldLabel:
    :
    : On Error GoTo 0
    : Reset the error checking to VB's standard.
    :
    : Note... for this error checking to work in the IDE (when running it in the development environment) you (might) need to adjust some settings. Go to Tools->Options, Tab General, set it to Break On Unhandled Errors or on Break in Class Module
    :
    : Greets...
    : Richard
    :
    :
    Sorry, it might be me going numb but where do I put this code?

    Thanks

    John
    Geek and proud :]
    www.geekandproud.co.uk

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    [b][red]This message was edited by BitByBit_Thor at 2005-4-19 11:52:37[/red][/b][hr]
    :Where do I put this code?
    Where you want to handle the errors yourself.

    A sample:
    [code]
    On Error Resume Next
    Err.Clear 'Clear all errors

    'Do database access for postal code here

    If Err.Number = 3021 Then
    MsgBox "Sorry, this postal code is not valid", vbExclamation
    Err.Clear
    ElseIf Err.Number <> 0
    'Some other error.
    'I am going to try something, but I don't know if this will work:
    'What I am trying to do is let VB handle with this error
    On Error GoTo 0
    Err.Raise Err.Number
    End If

    'Reset the Error Handling to default
    On Error GoTo 0
    [/code]
    Well... something like that anyway

    Greets...
    Richard



  • burgiburgi Posts: 79Member
    : [b][red]This message was edited by BitByBit_Thor at 2005-4-19 11:52:37[/red][/b][hr]
    : :Where do I put this code?
    : Where you want to handle the errors yourself.
    :
    : A sample:
    : [code]
    : On Error Resume Next
    : Err.Clear 'Clear all errors
    :
    : 'Do database access for postal code here
    :
    : If Err.Number = 3021 Then
    : MsgBox "Sorry, this postal code is not valid", vbExclamation
    : Err.Clear
    : ElseIf Err.Number <> 0
    : 'Some other error.
    : 'I am going to try something, but I don't know if this will work:
    : 'What I am trying to do is let VB handle with this error
    : On Error GoTo 0
    : Err.Raise Err.Number
    : End If
    :
    : 'Reset the Error Handling to default
    : On Error GoTo 0
    : [/code]
    : Well... something like that anyway
    :
    : Greets...
    : Richard
    :
    :
    :
    :
    Ah! yes, makes sense now. Thanks.

    *enters day 4 of not much sleep*

    the sales team better bloody well like it when I "present" it in... oooh.... a few hours... :[

    can you believe they want it documenting as well!

    Thanks again!

    John
    Geek and proud :]
    www.geekandproud.co.uk

Sign In or Register to comment.