Results 1 to 4 of 4
  1. #1
    Join Date
    May 2011
    Posts
    22

    Subform not connecting to main form correctly

    Hi,

    I have a form based on tblContact with a subform based on table
    tblCategories, and another subform based on tblCompany. I have a one-to-many
    relationship between tblCategories and tblCompany, with the pk in tblCategory
    linking with a fk in tblCompany. All of the fields in
    tblCategories/sbfrmCategories are yes/no fields, not sure if that plays into my
    problem at all.



    When a user checks one or more of the check boxes in the
    categories subform, closes the form and re-opens it, none of the check boxes are
    checked for that person. I know this has something to do with the relationships
    and how the categories are linked to the contact... but I can't get it straight
    in my mind as to how that should be set up.

    Here is my database. Help and advice for next steps is appreciated! Contacts Example.zip

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The data structure for categories is not correct.

    Can a company or contact be classified as more than one category?
    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
    Join Date
    May 2011
    Posts
    22
    A company or contact can have more than one of the category boxes checked, is that what you mean?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Yes, and this is a poor design. Multiple yes/no fields can be difficult to work with especially when all the fields are the same type of data. Also, if you want to add new category, that would mean a new field in table and revising queries, forms, reports, code.

    This data relationship is many-to-many. The conventional approach is a junction table to associate the entities.

    Consider:

    tblCompanies

    tblContacts

    tblCategories
    Category

    tblCompanyCategories
    CompanyID
    Category

    tblContactCategories
    ContactID
    Category
    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.

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

Similar Threads

  1. Replies: 15
    Last Post: 12-10-2012, 06:37 PM
  2. Replies: 3
    Last Post: 04-17-2012, 10:28 AM
  3. Totals from subform to main form
    By kathi2005 in forum Forms
    Replies: 4
    Last Post: 11-04-2011, 10:19 AM
  4. connecting many sub forms in one main form
    By Dasun in forum Programming
    Replies: 2
    Last Post: 07-01-2011, 02:39 PM
  5. Replies: 5
    Last Post: 03-17-2011, 06:21 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