Results 1 to 14 of 14
  1. #1
    stevieleser is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Manchester
    Posts
    5

    Relationships

    I manage a portfolio of 300 properties and I want to create a relationship between the tenants, visits done x 4, photos taken at each visit and letters sent for each visit. I have created 4 tables (tenants, visits, photos & letters) with a primary key in each and a foreign key linking all the forms. Is this correct? I keep getting errors saying 'relationship cannot be created.



    I could have put all the fields in 1 table but it would have been too long

    Any ideas?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,645
    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Since a Property could have different Tenants with time, I would expect to see a Property table.

    Here is a tutorial that you should work through to better understand relationships.
    Here is a sample data model that may help you with a design for Property management. It isn't specific to your requirement, but parts of it may be useful to you.

    Good luck with your project.

  4. #4
    stevieleser is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Manchester
    Posts
    5
    Thanks guys, I'll work through the tutorials. I didn't think of treating it as an 'estate agent' would opens up a whole lot more I could do. In the example I take it PF is "primary field" PK is "primary key" & FK is 'foreign key'

  5. #5
    MrRuz is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2013
    Posts
    10
    I'm curious, what did you end up doing? Did you build another table for property/apt, or both?

  6. #6
    stevieleser is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Manchester
    Posts
    5
    Yes I got the gist of it through the data model, still a bit confused though. I have many tenants who I visit 4 times, taking pictures & sending letters for each visit. I have set the r
    TenncyId to relate to the visits, photos & letters tables but
    T CNT seem to get the relationship right
    . Are they all 1 to many as 1tenant can have many visits, photos & letters?
    H

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,645
    Sounds like 1 to many to me. Unless a photo/letter can apply to more than one tenant.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    MrRuz is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2013
    Posts
    10
    Yeah that sound like its one to many (one tenant to many visits).
    It's difficult to say without seeing the data.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Do you really visit Tenants OR Properties?
    Can you post a copy of your relationships window as a jpg.
    Make sure all tables are expanded so all fields are visible.

  10. #10
    stevieleser is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Manchester
    Posts
    5
    Here are the tables & relationshipClick image for larger version. 

Name:	Screenshot 2014-10-29 07.07.00.png 
Views:	24 
Size:	179.6 KB 
ID:	18545

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,645
    Multiple similar fields indicates a non-normalized structure. Why are there 4 Visit fields in Visits table? Same for Letters. Shouldn't each record be a single visit or a single letter?

    Are these photos to document conditions during tenant's occupancy?

    You have PhotoID in Visits and Letters and Property tables but don't show links. Can same photos be associated with multiple letters and visits and properties?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    MrRuz is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2013
    Posts
    10
    Yeah, you need to normalize. This makes no sense. You have a field in the Tenants table for visits and then a table for visits too?

    Try:
    Table: Properties
    PK: Property
    [Property related fields]

    Table: Tenants
    PK: Tenent ID (autonumber)
    [Tenant related fields]

    Table: VisitNumber
    PK: Visit Number (1,2,3,4)


    Table: Tenant_Property
    PK: Tenant ID
    PK: Property ID
    [Tenant to property related fields]

    Table: Tenant_Property_Visit
    PK: Tenant ID
    PK: Property ID
    PK: Visit number (1 of 4) (Referential Integrity)




    I threw this together because I'm short on time. I'm unsure on the best way to run the visits table, but I'm sure other's will chime in

  13. #13
    stevieleser is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Manchester
    Posts
    5
    Before we go legal on tenancy breaches I have to visit 4 times with 7 days between each visit. The photos and letters are supposed to be attachments for each visit which is why I thought they had to be individual fields. In the tenants table that was to show all the visits, photos & letters and it works but the form is too big.

    I'll try your options & keep you posted.

  14. #14
    MrRuz is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2013
    Posts
    10
    yeah, then I think you'll want a visits specific table, with the letter, photo, and whatever else. Just concatenate visit, property, tenant as the ID. (That way, if a tenant moves to a separate property you can still track that tenant with minimal effort/redundancy).

    I'd also run a "managers" table too.

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

Similar Threads

  1. Explicit Relationships and Implicit Relationships
    By Dazza666 in forum Database Design
    Replies: 2
    Last Post: 07-17-2013, 02:11 AM
  2. Help with relationships
    By clive2011 in forum Access
    Replies: 5
    Last Post: 09-14-2011, 03:00 PM
  3. Relationships
    By neo651 in forum Database Design
    Replies: 2
    Last Post: 08-30-2011, 08:38 AM
  4. One to One Relationships
    By ketbdnetbp in forum Database Design
    Replies: 1
    Last Post: 04-27-2011, 11:22 AM
  5. Relationships again
    By BarbT in forum Access
    Replies: 2
    Last Post: 11-09-2010, 04:12 AM

Tags for this Thread

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