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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
data analyst 3 50
Format Meeting Request through VBA 5 22
field number type in access tabledefs fields 5 20
Running Total in Access 4 20
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

863 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

20 Experts available now in Live!

Get 1:1 Help Now