I found out that VB.net has a function that tells you the last line that executed properly. It is something like Err.LastLineExe cuted (its close anyway). However, this isn't available in Access VBA. I would like to possibly create something close to it. What I had in mind was to group my code and after the group executes successfully, then mark it as such. Something like this:
My thinking is that if the error happens in the first group of code, then it won't have reached line 8, intLastGroup will still equal 0 and my error message will post Error in group: 1. Does this seem like a good idea or does it add overhead that would slow everything down? Is there another way to get the same effect that would work better?
Code:
On Error GoTo Procedure_Error
Dim intLastGroup as Integer
intLastGroup = 0
'Set to 0 at the beginning of the function/sub
'first set of code
intLastGroup = 1
'more code in second group
intLastGroup = 2
Procedure_Exit:
Exit Sub
Procedure_Error:
MsgBox "Error Number: " & Err.Number & _
VbCrLf & "Description: " & Err.Description & _
VbCrLf & "Error in group: " & intLastGroup + 1 & _
VbCrLf & "Module: [I]module_name[/I]"
Resume Procedure_Exit
Comment