| re: Creating a conditional relationship with a subform
Hi. Relationships cannot be broken in the way you have suggested - either there is a relationship between two tables or there isn't. You will need to consider carefully which foreign keys are carried into the many-side table (represented by your subform), and what these represent.
I am not clear at present what your tables really do - if your asset may be hardware or software and you use an asset number as part of a compound key in your support log you will be unable to leave that out of the support log entry.
There is no problem about using an optional relationship to represent hardware and software items - given a suitably-defined set of relationships a left-join set in the relationships window will allow you to record support calls where there is no hardware-related element involved. It suggests that you would need two such optional (left-joined) relationships in your many-side table - one for the hardware item, and one for the software item, each of which may be left null if not required.
Left-joins are very useful for such optional relationships (those which are one to 0 or more, and not just one to many).
It may not be well-known that the relationships window allows you to set such outer join relationships directly when setting up the relationships and referential integrity for your tables.
If you need more detailed assistance with this it would help us if you posted the relevant metadata for the master and detail tables - the field names, types and details of PK/FK relationships.
As a final thought, if I were looking at assets as entities I would say that the type of the asset - hardware, software or any other classification - is a property of the asset, not of its support log entry. The type of the asset would be a non-optional property. Perhaps you could clarify the structure of your tables to help us to help you set up a better model of your data.
-Stewart
|