Referencing a form attached to a navigation tab in Access 2010.

I have a problem that is driving me insane trying to solve.

I am new to Access 2010, but having used VBA extensively in earlier versions, I am familiar with referencing controls on other forms etc.

I think the problem I have relates to the way that the navigation for works. I have 3 tabs and have loaded a form onto each. Two of the forms have sub forms. One of these forms works a treat and I can reference controls via VBA without an issue. However, where I am completely baffled is when I come to reference form 1 (on tab 1) from Form 2 (on tab 2). I had thought that as the foms were loaded into the tabs they were effectively sub forms in the navigation form.

When in design view I click on Tab 1 the form shows which is fine and when I click on the form within tab 1, it is described as a subform and has the name "Client Details" which is correct. When I select tab 2, the correct form (Clients) appears. However when I click on the form it is still described as "Client Details". Having spent half a day pondering this, am I to assume that the Navigation form is effectively just changing the source of what appears to be the "Client Details" to the "Clients" tab a bit like changing the SourceObject of a subform?

When I am in the form on Tab 1 I can pass data from controls into queries etc without problem. However, when I try to reference a control on the forms attached to the other two tabs I can't because the forms are not recognised. I am sure I must just be missing something simple, but it has brought me to a compete standstill.

Just for clarification I am familiar with syntax to reference sub forms etc. The problem here is that in code, the forms on the other tabs appear to be invisible.

I hope I have explained this OK, if not I am happy to clarify.
Who is Participating?

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

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.

I'm wondering if you don't really have the forms within the tab control's pages. Your form might instead be just on top of the tab control and so you see it on each tab page.  Try cutting out one form and pasting it back into the page.  Be sure that the page is selected when you paste.
martmacAuthor Commented:
No its not on top and is in the tab container and I do now think I have solved this. It is as I thought that the tabs simply load the forms as the tabs are selected, so there is just one container (in this case ClientDetails). The other forms on the other tabs are referenced via this container, so if I use [Forms]![NavigationMain]![ClientDetails].[Form]![Clients]![SearchText] for example in a query, the reference is fine. It is however very confusing and counterintuitive.
Thanks for taking the time to respond.

At least now I know how it works, I can move on after a day wasted trying to work it out. But isn't that how we always get there in the end, by just digging and digging!!
Hmm, I guess I didn't understand what you were originally saying.   To be honest, I still can't quite grasp what the problem your having is.  But if you're satisfied with how it's working then all is well.
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:

With the navigation form  your forms/reports are displayed in a  sub form control. That is why you must also include in the the reference the  navigation form as the parent form.

@ IrogSinta, This is referring to the new Navigation form in Access 2010. It is a new Tab Style way of displaying forms are sub forms.

Comparing the Navigation Form to the Tab Control

You may wonder why you might use the new navigation form feature instead of the standard Tab control, which provides similar functionality. One reason, of course, is that the Tab control does not provide a mechanism for supporting a hierarchy of options, as does the navigation form. To enable users to select a main category, and then select sub-categories, the navigation form is the only choice.

In addition, the load-time behavior is different for the two types of controls. The navigation form loads each child form or report on demand (that is, as you click the corresponding tab). The Tab control, however, loads all its child objects as it loads. Not only does this affect performance (when you open the main form, you must wait while the Tab control loads all its child objects), but it can also make it difficult when handling querying data. Because the navigation form loads each form as you click the corresponding tab, you can be certain that users see the most current data, without a need for you to create specific code that re-queries the form as users click each tab. This also means that the navigation form does not provide a specific event as you click each tab. Instead, place the load-time code in each form or report Load or Open event handler.


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
martmacAuthor Commented:
I thank you both for your help. I am slowly getting to grips with it and to be honest, am finding it really agile to develop in. As always in these situations you get too close to it then any answers are obscured by your need to find the answer.

I really do like the tab navigation as I am a big fan of loading on demand, having had bitter performance issues with Tab controls in earlier versions. As I am connecting to SQL Server and trying to balance of client and server side processing this is a really useful methodology. Now have to wrestle with the BrowseTo function as that is now my next mission. Have sort of got it working, but a few niggles!

Thanks again
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.