We help IT Professionals succeed at work.
Get Started

VBA Access Errohandler In Modules When Calling Other Modules

Dustin Stanley
on
85 Views
Last Modified: 2017-11-22
Let's say I have multiple modules for my code Module_1, Module_2, and Module_3.

**THIS IS JUST QUICK IN A HURRY SAMPLE BUT GIVES THE IDEA**
If in each Module at the beginning it say If error Goto Errorhandler:
Public Sub Module_1 ()
On error Goto Errorhandler
 Call Module_2
Exit Sub
Errorhandler:
 Yadda Yadda
Exit Sub

Open in new window


Public Sub Module_2 ()
On error Goto Errorhandler
If "" & Value1 = "" Then
 Call Module_3
End If
Exit Sub
Errorhandler:
 Yadda Yadda
Exit Sub

Open in new window


Public Sub Module_3 ()
On error Goto Errorhandler
 'Do Something Here
If Me.Dirty Then
Else
Exit Sub
Errorhandler:
 Yadda Yadda
Exit Sub

Open in new window


Then if there is an error in Module_1 or Module_2....
Which Module will the error handler come from?

This is just a little confusing and I am trouble shooting some modules.
Thanks for the help.
Comment
Watch Question
Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007
Commented:
This problem has been solved!
Unlock 4 Answers and 6 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE