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

Posted on 2013-06-30
Last Modified: 2013-07-01
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.
Question by:martmac
  • 2
  • 2
LVL 29

Expert Comment

ID: 39288932
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.

Author Comment

ID: 39289303
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!!
LVL 29

Assisted Solution

IrogSinta earned 250 total points
ID: 39289836
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.
LVL 21

Accepted Solution

Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 250 total points
ID: 39290221

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.


Author Closing Comment

ID: 39290313
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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now