A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Linking subforms



 
 
Thread Tools Display Modes
  #1  
Old August 28th, 2006, 07:02 AM posted to microsoft.public.access.forms
Pret
external usenet poster
 
Posts: 4
Default Linking subforms

I have two subforms I'd like to link (main form sets up a meeting, sbfA
selects cases to discuss, then sbfB records details for each case). I've
got the main form and the first subform working; but I can't get the first
and second subforms to link.

I've added a text box to the main form and set its control source as the
primary key in sbfA, intending then to have sbfB's foreign key link to the
text box; sort of a cascading link. I think it's a proper approach.

Problem is, I can't get the master links dialogue to pick up the text box as
part of the main form. Even when I go back and insert the second subform
with a wizard, it doesn't acknowledge the textbox.

Any ideas what's wrong, or alternate approaches? Before you suggest it: I'd
much prefer NOT to nest sbfB within sbfA.

Thanks.


  #2  
Old August 28th, 2006, 12:37 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP]
external usenet poster
 
Posts: 4,231
Default Linking subforms

There is an example in one of the Northwind sample database Orders forms.
Add a textbox on the main form set it = to:

=Forms!MainFormName!SubformAControlName.Form!Prima ryKey

IOW, use the value of the primary key of the subtable (not the foreign key
which is what is linked to the mainform).

In the LinkMaster/Child fields of the second subform, set the links to the
textbox on the main form. Now as you change records in subformA, you will
stay sync'd up to subformB.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Pret" wrote in message
...
I have two subforms I'd like to link (main form sets up a meeting, sbfA
selects cases to discuss, then sbfB records details for each case). I've
got the main form and the first subform working; but I can't get the first
and second subforms to link.

I've added a text box to the main form and set its control source as the
primary key in sbfA, intending then to have sbfB's foreign key link to the
text box; sort of a cascading link. I think it's a proper approach.

Problem is, I can't get the master links dialogue to pick up the text box
as
part of the main form. Even when I go back and insert the second subform
with a wizard, it doesn't acknowledge the textbox.

Any ideas what's wrong, or alternate approaches? Before you suggest it:
I'd
much prefer NOT to nest sbfB within sbfA.

Thanks.




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:56 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.