UtterAccess Discussion Forums
  UtterAccess Home  | Forums Index  | Search  | Links DB  | FAQs   
Microsoft® Access help forums plus Excel, Word, Outlook®, Visual Basic®, SQL Server®, Office online and... many more!

Access UtterAccess!
New? Welcome!
Join UA here!

Members Login


Password


Remember me!


Search The Database

More Links

  UtterAccess Links
  Link to UtterAccess
  Call UtterAccess Home
  Add UA to Favorites

Quick Jump



UA Recommended

Access Team Blog

UA Recommended

UA's own ScottGem
      and datAdrenaline!

Servers tuned by
Vaultechnology
Referencing a subform field from a 2nd subform

  Referencing a subform field from a 2nd subform  Version: Any Version 

Posted on 10/24/07 05:18 PM
Posted by ArtVandolay - Utter Access Addict
Posts: 61 -

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
I thought I was getting the hang of these bangs and brackets...

I have a form with 2 subforms. The ID field of the 1st subform is the master link field I need for the 2nd subform. I've tried everything (except the correct one). How does one reference a subform field from a different subform in the Link Master Field?

I did define a(n invisible) text field on the parent form and set it in the on current event of subform1 but I'm unhappy with this.

Thanks for any help you can provide. And if you can recommend a good source of info on referencing form fields, I'd really appreciate that, too.

--------------------
Wherever you go, there you are.

  Re: Referencing a subform field from a 2nd subform  Version: Any Version  [Re: ArtVandolay]

Posted on 10/24/07 05:22 PM
Posted by theDBguy - Utter Access VIP
Posts: 15332 - Loc: USA

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
Sorry, I couldn't understand your question, but here's a link that might be of help to you. Good luck.

Re: Referencing a subform field from a 2nd subform  Version: Any Version  [Re: ArtVandolay]

Posted on 10/25/07 12:36 AM
Posted by VanThienDinh - Utter Access Editor
Posts: 13437 - Loc: Sydney, AUSTRALIA

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
(Sorry, it is going to be hard to understand what I write.)

If I understand correctly, the "preferred" set-up according to the data structure is nested Subforms, i.e. one Subform is actually a Subform of the other Subform but you prefer to use 2 Subforms on the same level, both as Subforms of the main Form?

Thus, when the CurrentRecord changes on, says, Subform1, you actually want to requery the Subform2 to show only data related to the CurrentRecord on Subform1?

If yes, the intermediate (hidden TextBox) is one oft-recommended solution ... Perhaps, you should tell us why you are not happy with this solution???

Alternatively, you can use the reference something like:

Code:
[SubformCONTROLThatHousesSubform1].Form.[IDField]



as the LinkMasterFields for the [SubformCONTROLThatHousesSubform2].

Hopefully, you note that I clearly distinguish between [SubformCONTROL] and "Subform" since the common use of "Subform" actually comprises of 2 Access objects: a SubformControl (an empty "rectangle" whose most important Properties are LinkMasterFields and LinkChildFields) and a SourceObject (a Form that sits inside the above rectangle!). The consequence of this is that the SubformControl name may be the same or different from the name of the SourceObject, i.e. the name of the "Subform" as used by most people.

The word "Form" above (which means the SourceObject inside the SubformControl) is literal but you have to replace the others with appropriate names from your set-up.

The 3rd way, obviously, is to use VBA to re-assign the RecordSource for Subform2 or to requery the Subform2 where the RecordSource is a Parametrised Query.




--------------------
Van T. Dinh

  Re: Referencing a subform field from a 2nd subform  Version: Any Version  [Re: ArtVandolay]

Posted on 10/25/07 08:31 AM
Posted by ArtVandolay - Utter Access Addict
Posts: 61 -

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
"... but you prefer to use 2 Subforms on the same level, both as Subforms of the main Form? Thus, when the CurrentRecord changes on, says, Subform1, you actually want to requery the Subform2 to show only data related to the CurrentRecord on Subform1?"

Yes!


"If yes, the intermediate (hidden TextBox) is one oft-recommended solution ... Perhaps, you should tell us why you are not happy with this solution???"

Thank you very much!!!! The intermediate solution just seemed to me to be inelegant to do something so straighforward. If these intermediate hidden text boxes don't label me as someone who didn't know how to do it correctly, I'm happy

I love this forum! I'd be embarrassed to tell you how long I've been trying to reference the proper field in the Master Link Field, even though the intermediate text box was working.




--------------------
Wherever you go, there you are.


  Re: Referencing a subform field from a 2nd subform  Version: Any Version  [Re: ArtVandolay]

Posted on 10/25/07 10:33 AM
Posted by VanThienDinh - Utter Access Editor
Posts: 13437 - Loc: Sydney, AUSTRALIA

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
You're welcome ... Glad we could help ...



--------------------
Van T. Dinh

  Re: Referencing a subform field from a 2nd subform  Version: Any Version  [Re: ArtVandolay]

Posted on 02/19/09 02:35 PM
Posted by VelvetLounger - Utter Access Enthusiast
Posts: 34 -

Forum: Access Forms
• Edit
• Reply
• Quote
• Quick Reply
• Print this post
• Bookmark Post
• Notify Moderator

• Top of page
ArtVandolay.

Did you get a solution to this? How did you set up the invisible text field. I would accept that solution. I just need something that works. Thanks

Page Jump
Pages: 1

Navigate
Post List
Previous thread Previous
Next thread Next

Thread Options & Info
• Threaded
• Print Thread

• 461 Thread views

Page Jump
Pages: 1