error-scenarios that can not be trapped with @@error

error-scenarios that can not be trapped with @@error

Post by mberger3.. » Sat, 28 Aug 1999 04:00:00



Hello,

There seem to be a couple of error-scenarios, where a stored procedure

get there! (Example create a table that already exists...)

I'm looking for some kind of list of those errors, and possibly a way
to check beforehand, to avoid the error.

Or is there anything else you can do?

Does anybody know something? Or maybe a good book?
Any help would be appreaciated!

Thanks,

Mirjam

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 
 
 

1. Error Trapping: MS Access errors not trapped in VB code

I have an error trap in my VB 5.0 code that doesn't work when an error
is coming from and MS Access db.  These are errors that occur when
there is a primary key violation or a referential integrity violation.
I have done similar error trapping in the past and it worked fine.
The only difference in code is that I was using a data control in the
code that worked and now I'm working directly with the recordsets.  

The following is the code sample.  The error occus on rsPallet.Update:

        On Error GoTo ErrHandler

        rsPallet.AddNew
        rsPallet![StockNum] = txtPaperType.Text
        rsPallet![LoadTicket] = txtLoadNum.Text
        rsPallet![LinYds] = txtTotYards.Text
        rsPallet![DateRec] = txtTruckDate.Text
        rsPallet![RollCount] = txtNumRolls.Text
        rsPallet![UserId] = gUserID

ErrHandler:
    Dim errorNumber
    errorNumber = Err.Number
    Select Case errorNumber
    Case 3022   'primary key violation - load number is not unique for
the truck date given
        message = "Load number " & txtLoadNum.Text & " has been used
on " & txtTruckDate.Text _
                    & ".  Would you like me to assign a unique load
number?"
        answer = MsgBox(message, vbYesNo, "Primary Key Violation")
        If answer = vbNo Then
            txtStockNum.SetFocus
            txtStockNum.SelStart = 0
            txtStockNum.SelLength = Len(txtStockNum.Text)
        Else
            loadNumber = rsLoadNum![UniqueNum]
            txtStockNum.Text = loadNumber
            rsLoadNum![UniqueNum] = (loadNumber + 1)
        End If
    Case 3201   'invalid paper type, number given doesn't exit in
Paper table
        message = "The stock number " & txtStockNum.Text & " does not
exist." & _
                    "  Please enter a valid stock number."
        MsgBox message, vbExclamation, "Invalid Stock Number"
    Case Else
        message = "The following error has occured:  " & Err.Number &
", " & Err.Description

    End Select

Has anyone else encounter this problem or know the solution?

Thanks.

Sharon Stokesbary

2. Multiple databases

3. Error Trapping - Can you trap a DTS Package error using SQLDMO running a job

4. select filegroup with SELECT INTO?

5. ado errors not trapped by vb error object???

6. VB BCP Interfaces

7. Error not being trapped with @@error

8. <!-- To use a different cobrand, make sure you have a template for it in /parts/cobrand/ -->

9. @@error not trapping errors?

10. VB brRead - item missing not invoking on error trap

11. Errors not being trapped while changing DBC's

12. BULK INSERT does not allow error trapping.

13. Object variable or With block variable not set (Trapping SQL errors)