[AccessD] Conditional subforms

Stuart McLachlan stuart at lexacorp.com.pg
Thu Jun 18 20:03:56 CDT 2009


My standard way of doing this doesn't need any code, just:

1. Create a hidden textbox on the parent form "txtsubForm1Link" and set its source to  "= 
frmsubForm1.Form!fldPK"

2. Set the "Link Master Field" of subForm2 to "txtsubForm1Link" and the "Link Child Field" 
to the foreign key in Form2.

It's all automagic from then.

I often do this to several levels of cascaded continuous forms on an unbound parent form 
where there is a need to maintain the data in a hierarchy of related tables.

-- 
Stuart


On 18 Jun 2009 at 17:27, Jim Lawrence wrote:

> Hi All:
> 
> It has been a while since I have had to play with an Access DB but a client
> has called and I am doing nothing... but doing a Reno on the house.
> 
> I know how to do linked combo box; that a no brainer but how do I extend
> that logic to two inter-connected Subforms on a form.
> 
> When an item is selected on the subform 1 it would be nice to display all
> related items on subform 2. Also each subform should allow new items to be
> added and deleted...
> 
> With enough code this could be done but there must be some 'nice' way other
> than brute force.
> 
> TIA
> Jim   
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com





More information about the AccessD mailing list