Full Version: Using A Value Form One Sub-form To Filter Another Subform
UtterAccess Forums > Microsoft® Access > Access Forms
jppiii
Hi folks - it's been a while since I 'dabbled' in access, and sadly I've forgotten a few of the basics!!!!!
I have a main form, for the sake of ease call frm1 - this contains a number of controls, including Campaign_ID and two sub-forms, side by side called (imaginatively) subfrm1 and subfrm2
subfrm1 contains the controls Campaign_ID (foreign Key) and Market_ID (local key - both combined make the pkey)
subfrm2 contains the controls Campaign_ID (foreign key), Market_ID (foreign key) and Event_ID (local key - all three combined make the pkey)
Therefore, to put into context, the main form shows the campaign, the first sub-form shows the markets participating in the campaign and the second sub-form should show the milestone events for the currently selected market (from the first sub-form)
Ocan set the master/child links on the first sub-form, as the variable to link to is on the form.
I can't find a way to set the variable on the second sub-form as I can't find a way to link variables from two different sources (ie: frm1.campaign_id and frm1.subfrm1.rbu_id)...
Any amazingly obvious, or amazingly genius solutions out there? iconfused.gif
Thanks folks
Chris
nijinsky
subfrm1 contains the controls Campaign_ID (foreign Key) and Market_ID (local key - both combined make the pkey)
subfrm2 contains the controls Campaign_ID (foreign key), Market_ID (foreign key) and Event_ID (local key - all three combined make the pkey)
herefore, to put into context, the main form shows the campaign, the first sub-form shows the markets participating in the campaign and the second sub-form should show the milestone events for the currently selected market (from the first sub-form)

Why not try this:
Put a hidden control on the main form, MarketID
On subfrm1 CURRENT event, set main form's MarketID = subfrm1 Market_ID
Link subfrm2 master and child links to the main form's campaign ID and the Market ID field (you can have mre than one)
This way, every time you click a different Market_ID record on subfrm1, the Event data on subfrm2 should refresh
jppiii
Thanks nijinsky - I was almost there, but was trying to use the 'on change' event of the hidden control on the main form!!
orks perfectly now - thanks again,
Chris
vtd
See also UA Topic Referencing a subform field from a 2nd subform for another method using only the LinkMasterFields / LinkChildFields Property of the second SubForm.
jppiii
Thanks for the further information - using the hidden control on the master form and assigning it's value on the onCurrent event of the 1st subform did the trick perfectly... I have a new issue/challenge that I'm about to write up - so stick around to see if you cvan help there too!!
Cheers,
Chris
fundrink.gif
vtd
You're welcome... Glad we could help...
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.