Results 1 to 12 of 12
  1. #1
    zeryx is offline Novice
    Windows 11 Office 365
    Join Date
    Aug 2025
    Location
    Living in Scotland
    Posts
    4

    Question Help with referential integrity in relational database setup

    Hi all,
    I'm returning to Microsoft Access after nearly 25 years, and while I used to be very comfortable with it (especially database normalisation!), I'm finding myself a bit rusty and unsure about my current setup.
    I've created a relational database with the following tables:

    • Executive Offices
    • Offices
    • Identified Critical Products
    • Office Tools

    The intended relationships are:

    • One Executive Office can have many Offices.
    • One Office can have many Critical Products and Tools.
    • Each Critical Product or Tool can be used by multiple Offices.

    The goal is to store details about Executive Offices, Offices, and the products/tools they use — and to be able to display which Office uses which Critical Product and which Tool.
    However, I'm struggling to enforce referential integrity in the relationships, and I suspect my structure might not be correct. Could anyone advise on how best to model this setup, especially the many-to-many relationships between Offices and Products/Tools?


    Thanks in advance!

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Might want to upload your DB?, as you have not even shown what you have already?
    Even the Relationships window would be a start.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    zeryx is offline Novice
    Windows 11 Office 365
    Join Date
    Aug 2025
    Location
    Living in Scotland
    Posts
    4
    Click image for larger version. 

Name:	Relationships 25 Aug.jpg 
Views:	23 
Size:	83.1 KB 
ID:	53210Hi Welshgasman, thank you for your reply. I didn't upload my database as I wasn't aware it was possible. This is the relationships as they currently stand ... I've added a couple of tables to try and get my head round it, but have probably just confused matters even more!

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    OK, with just a quick look, use the parent ID as the foreign key for the many table, NOT the actual name.
    You need junction tables for many to many. What appears to be your junction tables (to the right of Offices, have incorrect joins on their right.

    So will have as an example tblOfficeTool and tblCriticalProduct. You name them as you see fit, but I only ever use enough characters to make them unique.

    It is a Royal PITA typing in Indentified_Office_Critical_Products_BIA all the time.
    Do NOT have spaces in object names, makes typing so much harder again as you have to enclose withing square brackets. You have underscore in some fields and not in others. Learn to be consistent in your naming. Makes coding so much easier.

    The Contingency measures might need to go into their own table. Most times when you have a repeating group, it should have it's own table. However I do not do that for addresses. The one time I break the rule.

    Here is a pic of my Bibby Gazette DB. The links table, links Crew, Ship, Date and Rank.
    Whilst I do not have or need junction tables, I am using ID fields. That links tables just holds those.

    The naming is not that great as that was my first database. I also used Table Lookups which is not recommended, but I am aware of how they work.
    Attached Thumbnails Attached Thumbnails Screenshot 2025-08-25 130924.png  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,818
    Hi
    Can you upload the actual database?

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    Each Critical Product or Tool can be used by multiple Offices.

    you need to clarify this statement as it could indicate a one to many relationship or many to many

  7. #7
    zeryx is offline Novice
    Windows 11 Office 365
    Join Date
    Aug 2025
    Location
    Living in Scotland
    Posts
    4
    Thank you, that was very helpful - and has resulted in a bit of restructuring! I'm know I've got it right as I can't get my relationships set up! I'll talk through this and hopefully it'll make sense.

    1 Executive Office has many Offices
    1 Office can have 1 BCP
    1 Office can have 1 BIA
    1 BCP can have 1 or more Critical Products
    1 BIA can have 1 or more Critical Products
    1 BCP Critical Product can have 1 or more Tools
    1 BIA Critical Product can have 1 or more Tools
    1 Tool have more than one Contingency Measure

    I feel like my mind is getting boggled now and I very much appreciate help!Click image for larger version. 

Name:	Relationships2 25 Aug.jpg 
Views:	18 
Size:	56.1 KB 
ID:	53212

  8. #8
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,818
    It would help if you upload a copy of the database with some data in each of the tables.

  9. #9
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,818
    Hi
    I believe the attached screenshot of your Relationships is nearer the mark.

    It would help if you give us examples of the data in tblContingencies as well as the other 3 tables dealing with Measures.
    Attached Thumbnails Attached Thumbnails Relationships.png  

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Upload an empty dB. Easier to modify.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #11
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,818
    The OP has contacted me and has settled on the attached relationships.
    Attached Thumbnails Attached Thumbnails Relationships.png  

  12. #12
    zeryx is offline Novice
    Windows 11 Office 365
    Join Date
    Aug 2025
    Location
    Living in Scotland
    Posts
    4
    I would like to say a MASSIVE thanks to Mike60Smart - your help has been invaluable!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Referential integrity rules
    By mhart in forum Database Design
    Replies: 2
    Last Post: 07-28-2011, 04:43 PM
  2. Referential Integrity
    By Desstro in forum Database Design
    Replies: 4
    Last Post: 06-13-2010, 01:29 PM
  3. Referential Integrity
    By U810190 in forum Access
    Replies: 1
    Last Post: 03-29-2010, 05:21 PM
  4. Referential Integrity
    By jbarrum in forum Access
    Replies: 5
    Last Post: 01-14-2010, 09:04 AM
  5. Data preventing Referential Integrity
    By RubberStamp in forum Access
    Replies: 0
    Last Post: 12-14-2008, 05:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums