Switching subforms based on a record selection

mattP

Registered User.
Local time
Today, 06:22
Joined
Jun 21, 2004
Messages
87
Right slightly complicated (in my eyes) and I have not found anything in previous threads to help but here goes:

I have a main form (FRM_SUMMARYREVIEW) that has an unbound subform field on it (subfrmmaster).

When FRM_SUMMARYREVIEW is first opened subfrmmaster has its sourceobject set to a form called FRM_OPENSUMMARY.

This subform lists all my open escalations, in a continuous forms format and has a field in it called "escalationid" and when I click this field "subfrmmaster" changes it's sourceobject to another form called FRM_MAINDATA and should display the data relevant to the escalationid I have just selected.

In the past I used to click on "escalationid" and it opened up FRM_MAINDATA as a new form, using the following code:

Dim Searchstr2 As String
Searchstr2 = "[Escalation ID] = " & Forms![FRM_SUMMARYREVIEW]![FRM_OPENSUMMARY].Form![escalationid]
DoCmd.OpenForm "FRM_MAINDATA", acNormal
Forms!FRM_MAINDATA.Filter = Searchstr2
Forms!FRM_MAINDATA.FilterOn = True

However how can I get the subfrmmaster sourceobject to change and display the relevant escalation detail ?

My other option is to have two subforms on the main form, one with "FRM_OPENSUMMARY" the other with "FRM_MAINDATA", as "FRM_OPENSUMMARY" has a list of escalations displayed, in a continuous forms format could I set it so as I arrow down the list, the data in FRM_MAINDATA displays the highlighted escalation in "FRM_OPENSUMMARY".

I hope this makes sense

MattP
 
Pat,

Do you mean to have both subforms on the screen together and link the parent/child ?

Regards

MattP
 
Pat,

Couls you confirm how I could do this (not sure on the coding) I have now set my main form to have both subforms on the same screen.

Sub from "FRM_SUMMARYOPEN" is at the top half of the screen, that lists all my current open records.

Sub Form "FRM_MAINDATA" is on the bottom half of the screen and this form has the details of a specific record.

The control source that I hope to use is a field called "EscalationID", which is listed in "FRM_SUMMARYOPEN" and FRM_MAINDATA"

So what I would like to do is to be able to either click on the "EscalationID" field or just arrow down the list and get the bottom form to show the data relevant to the highlighted record in the top subform.

I know you say use the Parent/child link but I'm not sure how

Hope that makes sense

Regards

MattP
 
Thanks Pat,

Got it working, makes perfect sense once I had read your repsonse.

Thanks for your help

MattP
 

Users who are viewing this thread

Back
Top Bottom