Results 1 to 13 of 13
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097

    Making a relationship One-To-Many

    I made a recent change to one of my table relationships. In the screenshot below, the relationship between "FamilyGrpID" in table on the left should be "One-To-Many" with "GroupID" in the Groups table. I can't find where to change the relationship type from "Intermediate" to "One-To-Many". What am I missing?

    (BTW, the table on the left is named "Families")



    Click image for larger version. 

Name:	000.jpg 
Views:	20 
Size:	65.3 KB 
ID:	37685

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    If you only have 1 indexed field, then its 1 to 1.
    If 1 family can have Many groups, then the tGroup table needs a 2nd key (or index).

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    I don't quite follow. Right now, I have a form whose RecordSource is the Families table (actually a query of that table). On that form currently, there's a text box that is bound to the GroupName field in table Groups via a DLookup control source. I.e., =DLookUp("GroupName","Groups","GroupID = " & FamilyGrpID). Right or wrong, I had the idea that if the relationship between the two was established that I could simply bind the control directly to "GroupName" and Access would find it. If that's a false notion on my part then I'll let the DLookup stand. But still, given an ID FamilyGrpID, there can theoretically be an infinite number of GroupNames to chose from. Where do I assign the index in the Groups table?

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Is the field Groups.GroupID an Autonumber?
    Is the field Families.FamilyGrpID Numeric (Long Integer)?

    Or are both field the same data type?


    If you double click the link between table Families and table Groups, does the "Edit Relationships" dialog box appear with "Enforce Referential Integrity" (RI) enabled?
    If YES, click the check box to the left of "Enforce Referential Integrity". Tada!


    If Access won't allow you to enable RI, then you might have entered a value in "Families.FamilyGrpID" that is NOT in "Groups.GroupID".

  5. #5
    theviking is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Location
    Northern New Jersey
    Posts
    15
    As ranman mentioned, you need to have an index (or key) on the GroupID which allows duplicate values.

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    GraeagleBill,

    I think what you need is to replace the text box on the form with a combo-box; its control source should be FamilyGrpID and its RowSource "Select GroupID, GroupName From Groups Order By GroupName;". Set its column count to 2 and the column widts to 0';2' (or whatever you need to accommodate your group names). Now when you select a group name in the combo it will save its GroupID in your Families table in the FamilyGrpID field.

    Cheers,
    Vlad

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    combo not applicable with the current app. (But that is how the GroupID is initially obtained.)

  8. #8
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Did you try Post#4?

  9. #9
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    I replied to #4 yesterday but I don't see it within the thread???
    Anyway,
    Is the field Groups.GroupID an Autonumber?
    Is the field Families.FamilyGrpID Numeric (Long Integer)?
    YES

    Or are both field the same data type?
    YES

    does the "Edit Relationships" dialog box appear
    YES, as pictured in the OP. As you can see, "Enforce Referential Integrity" is not checked and nothing I attempt to do with the "Edit" menu has any effect.

  10. #10
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I looked to see if I had a copy of your dB, but didn't find one.
    Would you make a copy of the dB, delete all records, do a "Compact and Repair", compress (zip) it and post it?

  11. #11
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    I appreciate your willingness to examine the app but it's really big and more work to package up for this issue than I have time for. (Over 5K LOC, 60 Forms, 70+ queries, reports, tables, blah, blah blah)
    Thanks,
    Bill

  12. #12
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Delete the records, forms, queries, reports, modules and macros (if any). Just keep the tables.

    Trying to see why you can't set RI on tblGroups per image in Post #1.......

  13. #13
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,097
    I'll see if I can make time on Friday or Saturday to configure a DB you can play with.

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

Similar Threads

  1. Making everything appear
    By UT227 in forum Queries
    Replies: 26
    Last Post: 01-08-2018, 05:34 PM
  2. Making forms look better
    By Lou_Reed in forum Access
    Replies: 2
    Last Post: 04-18-2016, 12:56 PM
  3. Replies: 3
    Last Post: 03-19-2015, 05:26 PM
  4. Help making 1 to 1 relationship
    By Rhino373 in forum Programming
    Replies: 2
    Last Post: 06-15-2011, 02:51 PM
  5. Help with making a calendar
    By slmorgan25 in forum Access
    Replies: 1
    Last Post: 09-15-2010, 10:32 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