Hello all,
I have a question about adding in code in the error handling.
How does the error handling execute the code. For example, in the following code, I want to delete the querydef if there was a problem executing it. I understand that there are a million ways to handle this and this isn't probably the best way but I have had other situations that this would have worked great for (but didn't for the same reason).
So, if I add in the line to delete the querydef it gives me an error. My question is, what code is executed and when? I thought that the code under DRStats_Err_Exit: would not execute unless it was told to, is this correct? But it seems that if I try to add any code in there it will always run.
Thanks,
Stoss
I have a question about adding in code in the error handling.
How does the error handling execute the code. For example, in the following code, I want to delete the querydef if there was a problem executing it. I understand that there are a million ways to handle this and this isn't probably the best way but I have had other situations that this would have worked great for (but didn't for the same reason).
So, if I add in the line to delete the querydef it gives me an error. My question is, what code is executed and when? I thought that the code under DRStats_Err_Exit: would not execute unless it was told to, is this correct? But it seems that if I try to add any code in there it will always run.
Code:
On Error GoTo DRStats_Err
....all misc code here
DRStats_Err_Exit:
'THE NEXT LINE IS IN QUESTION....
dbs.QueryDefs.Delete strQName
Exit Sub
DRStats_Err:
MsgBox Error$
Resume DRStats_Err_Exit
Thanks,
Stoss