CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 1999
    Posts
    104

    error trapping Urgent

    How can I examine an error code from ODBC and Oracle
    using VBA?

    if I use form_error, I can trap the error but dataerr gives me the code 7786 for different errors.


  2. #2
    Join Date
    Mar 2004
    Posts
    12

    Re: error trapping Urgent

    Id you Lookup ODBC Errors youll Fin that there is an err code number block assigned to odbc.

    Rather than using access form method try this:

    Private sub MysubName

    On Error Goto MySubNameErr


    'You normal code goes in here

    'eg..Test this by using didvision by 0

    dim int1,int2 as integer
    dim intAns as integer
    int1 = 5
    int2 = 0
    intAns = int1/int2

    Exit sub (or exit function for function)
    Msgbox err.Number & "- " & vbcrlf & Err.Description,Vbinformation,"Error Trap Example"
    Err.Clear
    'then decide on Resume next or Exit Sub
    'generally I exit sub so it doesnt have a chance to create more errors

    End Sub

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

Featured