home

Having 2nd-Level Subform on Parent Form

7/9/01 10:42:04 AM
How I Fixed This

Newsgroup Message:

I have Access 97, Windows NT 4 SP6. I have a parent form named "main_machine_form." These form has 2 subforms, though one of the subforms is, in a way, a subform of the OTHER subform.

The 1st subform is named "process_tracking_subform," and the other subform is named "process_log_subform." Both subforms show records in "continuous form" mode. What I want the "log" subform to do is show certain entries based on what record in the "tracking" subform has been selected. The field in the "tracking" subform which is the "parent" field is called "process_id," and the "child" field in the "log" subform is also called "process_id."

In trying to achieve this, I setup the "log" subform as follows:

master: [process_tracking_subform]![process_id]
child: [process_id]

Instead, what this does is show the appropriate records based on the 1st entry in the "tracking" subform when I want it to show the appropriate records based on what entry is SELECTED in the "tracking" subform.

Any tips?

Larry
microsoft.public.access.formscoding

You're really close. What you need is a "relay" control on the mainform - an unbound textbox (which can be invisible) that you use as the Master of the second subform. Set its value in the Current event of the first subform.

John W. Vinson[MVP]
http://go.compuserve.com/msdevapps?loc=us&access=public


How I Fixed This

I fixed this based on the above reply to my newsgroup message. I added a text box to the main form, named it "relay1," and left it "unbound" and made it "invisible." The "log" subform referred to this control as the "master field." Then, added the following code to the "on current" event of the "tracking" subform:

Forms![main_machine_form]![relay1] = Me.process_id