Does MS Access 2007 support internal foreign keys within the same table?
+1
A:
Yes. Create the table with the hierarchy.
id - autonumber - primary key
parent_id - number
value
Go to the relationships screen. Add the hierarchy table twice. Connect the id and the parent_id fields. Enforce referential integrity.
Jason Lepack
2008-10-02 17:53:23
You might also want to make the parent_id's default is null/empty. Otherwise every element will require a parent (even if it is itself)
CodeSlave
2008-10-02 18:04:00
A:
Yes it does.
Under database tools and relationships you need to show 2 copies of the self-referencing table. It will name the second copy Table_1. Then you setup a relationship between the primary key in "table" and the foreign key column(s) in "Table_1".
Aheho
2008-10-02 18:01:09
A:
Yes it does and unlike many more capable SQLs (e.g. SQL Server) you can also use CASCADE referential actions on FKs within the same table, which is nice.
onedaywhen
2008-10-03 07:17:56