Usings tabs in forms with same primary key

M

mriesenb

Hi,

I want to set up this:

Create a tabbed form with on each tab an existing form:

Tab1: customers
Tab2: projects
Tab3: sla's

All forms are linked to their own table but share the same key
(customerID).

Now, what I want to for the user to select the customer on tab1 (a
continues form) and when he selects tab2 he gets the projects for that
specific customer. The same with Tab3, etc.

Maybe I'm overlooking something but what I have now is that when I
select the second customer on tab1 and I select Tab2 I get the projects
for the first customer in the listing of tab1.

How can I make sure that once tab2 is selected only the records for
that specific customer are shown?

Thanks in advance!

Michael
 
A

Arvin Meyer [MVP]

If you use controls from the main form on tab1, and subforms on subsequent
tabs linked to the primary key on tab1, you get what you want.

If if your mainform is unbound and/or tab1 contains a subform, then you need
to place a control on the main form and set its controlsource to:

=Forms!MainFormName!SubformControlName.Form!PKControlName

then you need to link your subforms on tabs2, 3, etc. to that control.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
M

Michael Riesenbeck

If you use controls from the main form on tab1, and subforms on subsequent
tabs linked to the primary key on tab1, you get what you want.

If if your mainform is unbound and/or tab1 contains a subform, then you need
to place a control on the main form and set its controlsource to:

=Forms!MainFormName!SubformControlName.Form!PKControlName

then you need to link your subforms on tabs2, 3, etc. to that control.

Would anyone have an example form with two tabs which do this? I have
spent quite some hours trying the suggestions but somehow it just
doesn't work.

Basically I created one new for, choose to add two tabs via the tabs
wizard. I suppose my main form (customers) should be on tab1, so I
dragged and dropped that onto tab1, then the projectsform I already
had I dropped onto tab2. Since there is a releationship between the
two tables and they share the same key (customerID) I thought this
should work. I tried the suggestion but then on tab2 none of my
customerID's are filled in automatically.

Any help would be appreciated!

Thanks,

Michael
 
M

Michael Riesenbeck

Would anyone have an example form with two tabs which do this? I have
spent quite some hours trying the suggestions but somehow it just
doesn't work.

Basically I created one new for, choose to add two tabs via the tabs
wizard. I suppose my main form (customers) should be on tab1, so I
dragged and dropped that onto tab1, then the projectsform I already
had I dropped onto tab2. Since there is a releationship between the
two tables and they share the same key (customerID) I thought this
should work. I tried the suggestion but then on tab2 none of my
customerID's are filled in automatically.

Any help would be appreciated!

Thanks,

Michael


I think I know where it fails. In the examples I've seen the tabs all
display data from the same table. Now I want my tabs to display data
from different tables:

Eg:

Tab1: Customers
Tab2: Projects
Tab3: Leads
etc.

The common key is CustomerID which links customers to projects and
lead to customers, etc.

How can I get this to work?

Thanks!

MR
 
M

Michael Riesenbeck

I think I know where it fails. In the examples I've seen the tabs all
display data from the same table. Now I want my tabs to display data
from different tables:

Eg:

Tab1: Customers
Tab2: Projects
Tab3: Leads
etc.

The common key is CustomerID which links customers to projects and
lead to customers, etc.

How can I get this to work?

Thanks!

MR

I'm a step closer now. It works but ONLY if my first tab is a single
page. BUT, I need to have a continuesly form as my first tab form....

Thanks,


MR
 
A

Amy Blankenship

What about this...have an "outer" form that all it does is select the
customer ID. You can make it a combobox if you need to. Then, use the
subform control to add 3 new "child" forms, one on each tab.

HTH;

Amy
 
A

Arvin Meyer [MVP]

Have a look at the CustomerOrders form in the Northwind sample database that
comes with Access. It has 2 subforms, sync'd to the main form with the
second sync'd to the first. While it isn't on tabs, it works the same way.
Look at how the forms link (Click on the property sheet data tab to see the
links) The first links to the main form on CustomerID, the second one links
to the first on ProductID. This is more complex than what you want. You need
to link all of your tabbed subforms to the mainform on the CustomerID field.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top