microsoft access 2007 wait for a module to finish before starting another module

I have about 22 modules, that need to run in order.  The results of each module is dependent on the previous module.  I need to ensure that the module has run and finished without errors before starting the next one.  I have created a module called "Testing" where I am calling my other modules "Call calculate_line1", line2, line 3 etc. all the way to line 26.  I just need to make sure that line1 has finished processing before line2 etc. and I need to automate.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

That is the way the code runs, the first line will be executed before the next. If the code can encounter an error (which I'm sure it can) you should use error handling in each sub-routine.
Jeffrey CoachmanMIS LiasonCommented:
Also, FWIW,

The code for a lot of these modules is basically the same...
Ultimately, you should try to consolidate one module to work for multiple functions

Just FYI

When you say modules, do you really mean the procedures inside a module?  There are 2 kinds of procedures; Subs (a.k.a subroutines) and Functions.  

With 22 of these it sounds like you need to revisit your process.  A single loop routine may probably work in its place.  Perhaps you can post some of your code and we can help you there.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
In addition to what the other Experts have posted, the way I normally execute procedural code is by using Functions, and having each Function return a response code (usually just True or False). I check that return code before running the next routine, which insures that RoutineA completes before RoutineB. For example:

Dim fOK As Boolean

fOK = MyFirstProcedure

If fOK Then
  fOK = MySecondProcedure
End If

If fOK Then
  fOK = MyThirdProcedure
End If

Your various procedures would then return a True or False, and your code could take action based on each. For example, I often log actions at the end of a process, which is not a required process - so my action there may be simply to alert someone, or just ignore it depending on the sort of impact I think it may have.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

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.