[AccessD] Two levels up (or down) , twice removed

Stuart McLachlan stuart at lexacorp.com.pg
Sat Feb 6 07:31:33 CST 2010


I'll try to explain it more clearly. 

The topmost form is an unbound form - frmWrapper
frmParent, frmChild and frmGrandchild are all subforms on frmWrapper.
txtParentLink and txtChildLink are controls on frmWrapper.

The Source of txtParentLink is set to =frmParent!Form.PK
The Source of txtChildLink is set to =frmChild!Form.PK

The Link Master Fields of frmChild is set to =txtParentLink
The Link Master Fields of the frmGrandchild is set to =txtChildLink

Now change the current record in frmParent:
txtParentLink automatically updates to the new Parent.PK
frmChild automatically requeries based on the new content of txtParentLink (frmParent,PK)
txtChildLink automatically updates to the new Child.PK.
frmGrandchild automatically requeries based on the new content of txtChildLink(frmChild.PK)

It all happens without any on_current code.

I can put a simple demo up on-line if you like.
-- 
Stuart


 On 6 Feb 2010 at 8:06, Jim Dettman wrote:

> Stuart,
> 
> <<There's no need for an OnCurrent event if you set the source of the hidden
> control to the PK 
> of the recordset of its  parent form.>>
> 
>   Not sure I understand; the grandchild is related to the child subform, not
> the parent. You need to do that on the grandchild to get the grandchild form
> to sync properly to the child subform.
> 
>   It's the only way I know of putting both child and grandchild on a main
> form.
> 
> Jim.
> 




More information about the AccessD mailing list