tags:

views:

765

answers:

3

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
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
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
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