• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 132
  • Last Modified:

Error collection

Hallo


I use this code to connect to database Access and run some update query.

Dim db As Database
Dim qd As QueryDef
Set db = OpenDatabase(nomefile)

On top of code i use

on error resume next
Err.Clear
Errors.Refresh

to manage errors.

My problem is :

at end of code the number of error is one (errors.count)
there is only last error in err(0).description
but the errors are most...

if i comment last sql update, the error indicated is last not commented !

How i read all error ???


THANKSS!!
0
kaiou
Asked:
kaiou
1 Solution
 
ShauliCommented:
The reason you get only 1 error (the last one) is because On Error Resume Next automatically does also Err.Clear. So, instead of using On Error Resume Next, use On Error Goto errHandling, as in:

'on top of code
On Error GoTo errHhandling

'do you stuff

Exit Sub

errHandling:
'here you can count the errors, collect their numbers and descriptions, handle it, clear it, and resume or resume next when
'you finish doing all the handling.
End Sub

S
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now