[AccessD] Represent Hierarchical Data On A Form

Stuart McLachlan stuart at lexacorp.com.pg
Mon Apr 28 17:07:40 CDT 2003


On 28 Apr 2003 at 13:07, Mcgillivray, Donald [CC] wrote:

> Using Access97 on Windows 2000.
> 
> I have three tables from which I want to display related data on a
> single form.  
> 
> The tables are hierarchically related: 
> 
> tblProjects is the uppermost parent
> tblPhases contains child records related to specific records in
> tblProjects
> tblMilestones contains child records related to specific records in
> tblPhases
> 
> My approach so far has been to create an unbound main form with three
> combo boxes - one for each table in the hierarchy, returning the
> table's primary key - and then to embed a single-form subform for each
> table in a tab control. 

I usually do this with three subs forms and a couple of hidden boxes.
Include a hidden textbox in each subform detail containing the PK 

Create a hidden textbox txtProject. Set it's source to "= 
subfrmProjects.PK".
Create a hidden textbox txtPhases. Set it's source to " = 
subfrmPhases.PK"
Set subfrmPhases "Link Master Field" to txtProject
Set subfrmMilestones "Link Master Field" to txtPhase

Now whenever you click on a record it Projects, Phases will display 
the appropriate records, same with Phases/Milestones.

To allow you to add records, set subfrmMilestones.Before Update to 
include:

Phase_FK = Forms.frmMainForm.txtPhases.

Similarly in subfrmPhases "Before Uupdate":
Project_FK = Forms.frmMain.txtProject



-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System 
Support.





More information about the AccessD mailing list