Varda:
>>But he also wants to track any projects that are related<<
This is similar to the classic bill of materials problem, in which an assembly might be made up of other assemblies which are made up of other assemblies and so on down to the atomic parts. In this all assemblies and atomic parts are stored as rows in a Parts table and a PartStructure table with columns such as MajorPart and Minorpart models the relationship.
In your case a project is the equivalent of an assembly, and may comprise other sub-projects, which in turn might comprise their own sub-projects. In your example putting in the windows is a sub-project of building the wall, which in turn might be a sub-project of build house.
So to model this you'd have a table Projects with a primary key ProjectID and a table ProjectStructure say, with columns MainProject and SubProject say each referencing the primary key of Projects. The problem comes when you want to create a report or form which shows the projects, their sub-projects, their sub-projects and so on. To do this requires recursive querying. Now while recursion is no problem with VBA functions you cannot have recursive queries. It is possible to simulate recursion however and there have been various means devised for doing this. Some years ago I produced a little demo of a way I'd worked out to accompany a magazine article. This works by creating a separate temporary database and tables in it from the stored data. I'm attaching this as a Zip archive, which includes the original ReadMe file giving an explanation of how its done. The database includes a report, which is printed from a button on the main form. This report is based on the BoM table created in the external database, joined in a query to two instances of the local Parts table. The Zip archive also includes a PartsTree database which illustrates a means of displaying the data as an indented tree type report.
You should, I think, be able to adapt this approach to your client's requirements without too much trouble.
PS: I seem to be having trouble getting the attachment to stick, so you may find this message has been edited a few times!
Regards
Ken Ken Sheridan, Stafford, England
Edited 3/9/05 by Ken Sheridan
Edited 3/9/05 by Ken Sheridan |