stevefutcher
Technical User
My organisation performs a number of different collection services from a large number of premises. The most complicated situation I am trying to model involves a block of flats/ apartments / retirement home.
In this scenario we might have 16 flats in 4 blocks of 4. Blocks 1 & 2 have collection A made from containers located in the car park, blocks 3 & 4 have collection A made from containers located by the gates, collection B is made from containers located in each block and collection C is made from containers located in each property.
If I create a parent record for the whole complex, then I lose the details of which containers are for which properties, as they are all grouped together. If however, I make parent records for the half complex communal containers (for collection A), and a parent record for each block (for collection B) and I already have an individual premises record for collection C then I have a suitable premises record for each collection and for all containers.
The problem comes when I want to create a query which will display the premises ID of the property I am viewing, together with the premises ID of any parent(s) AND any children, all in the same PremID field so that I can summarise all collections and container data in a single view.
At the moment I am using two tables tblPremises (PK PremID) and tblParentChild fields (Parent_PremID, Child_PremID) to record the relationships between parent & child premises, and I am creating a temporary table, and appending the parent & child records to it as a three query process in order to discover all relevant collections.
I can't help but think that there is an easier way - either a change of structure or a better query - anybody got any suggestions.
In this scenario we might have 16 flats in 4 blocks of 4. Blocks 1 & 2 have collection A made from containers located in the car park, blocks 3 & 4 have collection A made from containers located by the gates, collection B is made from containers located in each block and collection C is made from containers located in each property.
If I create a parent record for the whole complex, then I lose the details of which containers are for which properties, as they are all grouped together. If however, I make parent records for the half complex communal containers (for collection A), and a parent record for each block (for collection B) and I already have an individual premises record for collection C then I have a suitable premises record for each collection and for all containers.
The problem comes when I want to create a query which will display the premises ID of the property I am viewing, together with the premises ID of any parent(s) AND any children, all in the same PremID field so that I can summarise all collections and container data in a single view.
At the moment I am using two tables tblPremises (PK PremID) and tblParentChild fields (Parent_PremID, Child_PremID) to record the relationships between parent & child premises, and I am creating a temporary table, and appending the parent & child records to it as a three query process in order to discover all relevant collections.
I can't help but think that there is an easier way - either a change of structure or a better query - anybody got any suggestions.