Can not close form with navigation buttons

In Access 2010 I have a main form frm_Main and three other forms: frm_B1, frm_B2, frm_Reports  that are located on Main form navigation buttons Nav_B1, Nav_B2, Nav_Rep
They are all unbound forms.
When App starts it opens in frm_B1.
Frm_B1 and frm_B2 are in Parent Child relations.
I am updating tables on close even of frm_B1 and frm_B2 it means when Nav_B1 or Nav_B2 are clicked.
This is working ok, however I have issue with exit from application button.When I put exit button on frm_Main it gives me error:  2450 Microsoft Access cannot find the referenced form “frm_Main”.
On frm_Main I do not have any event happening.
On closing forms I assume that first are closed sub forms then main form, so even if on sub forms frm_Main is referenced it is open and present at that moment and Access should not throw this error.
First I can not figure point where this is happening and triggered and then how to  avoid this.
TarasAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Fabrice LambertConsultingCommented:
Hi,

Source code or file please ?
My crystal ball is broken...
TarasAuthor Commented:
Fabrice,  you can not even suggest where to look. Anyway thank you for your time and support.

I was expected that you will tell me open that and that form then  go to the line of code that  states that and that and that move last coma in string  and put double quotes without ampersand.

This is serious site by I like your sense of humor.
TarasAuthor Commented:
If somebody can suggest me how to trap where this error happened?

That would be good starting point.
I have  error handling in each procedure.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Fabrice LambertConsultingCommented:
Your issue can be many things.

Put breakpoints in your event handlers, execute step by step, check variables values in the spy window or execution window (basic debugging stuffs).

Other than that, without seeing the code, there isn't much we can do.
Dale FyeOwner, Developing Solutions LLCCommented:
I would start with a breakpoint in the click event of the Close button.  This will allow you to step through the code to determine what is happening.  But you might also want to put some debug.print commands in the Form_Close events of each of these forms.  What you may find is that they don't actually close in the order that you think they do.

Are you actually using a "navigation form" or have you created your own menu form with buttons.  I detest the "navigation form" as referencing the active form can be a real challenge, because there is a main form, (NavigationForm) with a subform (Navigationsubform), and the buttons on the navigation subform change the SourceObject for the NavigationSubform control.

HTH
Dale

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
John TsioumprisSoftware & Systems EngineerCommented:
Put a breakpoint on the following events on the main form
On Close
On DeActivate
On Error
If this fail maybe you have something in the subforms..
TarasAuthor Commented:
John I mentioned that I do not have any event on frm_Main.
So no need to check events on frm_Main.
Dale was close one of sub form frm_B1 in close event call save procedure that was referencing frm_B1 that was NavigationSubform  on NavigationForm - frm_Main. So, during closing application(exit) I am not sure in which order forms are closed but
It is always good design not to put in form close event save procedure that referencing some other form.
Those NavigationForm and navigation Navigationsubforms are terrible option for what application front end was doing and  are not good  design at all.  
I inherited this database from somebody else.
Error handling message was not made in such way that you can easy get clue to which procedure it is related  to.
It is much better if in error handler beside error number, and error description to add some text about procedure title or procedure name.
Thank you to all.
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.