Linking two Subforms

Guirg

Registered User.
Local time
Today, 19:02
Joined
Jun 2, 2009
Messages
96
Hi

I have 2 subforms and 2 filters connected by one search button... Is it possible to have when one filter returns a result the second subform uses a date column from the original subform and then filters itself using that? that way if i only have a small section of data i can find as much data from both forms for the dates it occured?

Cheers

Guirg
 
because you cant have a master/child relationship, the easiest way is as follows

in the left subform, current event - set a field in the parent form to indicate the common bit - eg the date. or the record id

something like

parent!importantfield = me!id


------
now base the other subform on a query that references the "importantfield" we just used

so now you can say

parent!secondsubform.requery

------
so the whole thing is

parent!importantfield = me!id
parent!secondsubform.requery


you may get an issue if there is no record in the first subform, because then this current event wont fire, which is sortable with a bit more messing around
 
ok ive gone a little space cadety here where do i apply the code?
 
ive said - normally in the current event of the left subform - since it is when you change that, that you need the right subform to respond
 
cheers for your help but im still lost, im thinking ill try and find another method.. does ur method allow it to be done both ways as well? so i apply a filter to subform2 and then send it back to the original subform?
 
well normally a form/subform implies a relationship

there are items on one form (the master) which have related items on the other form (the child). Access can mange this automatically without code, so as you change items in the main form, the subform automatically shows the related items

now access ONLY lets you automate this if the master is a SINGLE form, not continuous. The child is generally continuous as the relation will mostly be 1-many.

Now if you want the main form to be continuous as well (eg a continuous form of customers, and as you pick each customer, the subform shows the orders for each customer) you have to get access to manage the relationship a bit differently. Hence the suggestion above.

If you DO NOT have a situation where the subform is showing items dependent on the main form selection - then you just have 2 generic unrelated forms really
 
Ahhhhh ok now im following then yeah i just have 2 generic forms as datasheets sitting on one form with option buttons and unbound text boxes... i have 2 filters one for each generic form connected by one search button... Theres date column in each and what i wanted was when i filter for a sepcific number in one form it will then take the dates and filter the second form for those dates... and visa versa... does this change it from the realm of possible to non? cheers
Tim
 

Users who are viewing this thread

Back
Top Bottom