[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 130
  • 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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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