Link to home
Start Free TrialLog in
Avatar of martmac
martmacFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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.
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

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.
Avatar of martmac

ASKER

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!!
SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of martmac

ASKER

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