How do I catch a SQL error in VB6 while updateing a recordset?

I have this line in my code:
VB doesn't seem to catch any errors in data that cause this update to fail with the standard "on error" method.
How can I catch an update error?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
In vb6, we use "on error goto errorHandler" method to capture any error within your codes, sorry, there is no try ... end try statement in vb6, that's only available in
yyuubum2Author Commented:
Yes..but the   ADORS.UPDATE  error doesn't seem to trip a VB error condition.
VB doesn't know the recordset didn't update due to data problems.
Still looking ....
Leigh PurvisDatabase DeveloperCommented:
Have you examined the ADO errors collection after attempting your update?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

yyuubum2Author Commented:
Can you help me out here.
I'm not familiar with how to do that..
Maybe an example?
Leigh PurvisDatabase DeveloperCommented:
An example of examining the error collection after attempting some data update

Private Sub cmdADOErr_Click()
On Error GoTo errHere

    Dim cnn As New ADODB.Connection
    Dim errADO As ADODB.Error
    cnn.Open "Your Connect String"
    cnn.Execute "UPDATE tblTable SET Field1 = 'Leigh' WHERE FieldID = 1"
    For Each errADO In cnn.Errors
        MsgBox errADO.Number & " : " & errADO.Description & " : " & errADO.NativeError
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Leigh PurvisDatabase DeveloperCommented:
Did the errors collection prove revealing for you then?
(Not a briliant example I know - just a rough idea :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.