Results 1 to 6 of 6
  1. #1
    dollylectric is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    4

    Populating Subform Field from Subform Control Source

    I am working with a form called "frm_schools_copy" with 2 subforms: "frm_contacts_schools" and "frm_school_contact_person".



    The form "frm_contacts_schools" has 2fields that I would like populated automatically based on the current records shown on the form: School ID from "frm_schools_copy" and School Contact Person ID from "frm_school_contact_person". School ID works no problem because it is linked to the master form. School Contact Person ID doesn't work because you can't use a control from a subform as the control source.

    Came up with a work around that should work, for some reason is not.

    I created an invisible text box (Control Name is "Text26" on the main form ("frm_schools_copy") with the control source =[frm_school_contact_person].[Form]![Contact Person ID]

    Then I made the control source for School Contact Person ID =[Forms]![frm_schools_copy]![Text26]

    This ALMOST works. It gives populates with the number in the invisible text box when you open the form. But when I change records in subform "frm_school_contact_person" the invisible text box changes its value but not the School Contact Person ID control in the "frm_contacts_schools" subform.

    Any ideas why and how to fix? Or any ideas on another way to populate this field?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    What is data relationship? Each school can have more than one contact person? Can a person be a contact for only one school?
    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
    dollylectric is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    4
    Schools can have more than 1 contact person; contact person can only have 1 school.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Another question. Will every person in contacts table be a contact for some school? If so, just put the school ID in contact info table.

    Do you want to provide project for analysis? Make copy, remove confidential data, zip if still large, attach to 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.

  5. #5
    dollylectric is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    4
    I attached the file here. As you can see, I do have the school ID in the contact persons table (every contact person is associated with a school ID). I made the schools form the main form for usability and ease of navigation for the user, as they will almost always be trying to find the school and not the contact person.

    BTW, I am a pretty new user to Access, so if you see anything else in there that's off or could be better, feel free to chime in!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Here is what I understand about your db.

    Tables:
    Schools (school info)
    School_Contact_Person (contact info)
    Contacts_Schools (contact events)

    Your frm_Schools is a form with two subforms.

    ContactID control of Contacts_Schools subform should be a multi-column combobox. RowSource of the combobox should be filtered to only the contacts associated with the school. Review tutorials on comboboxes at http://www.datapigtechnologies.com/AccessMain.htm

    The Master/Child link properties will force the SchoolID fields of the subforms to populate with the SchoolID of the main form. These fields should not be available to the users because don't want them accidentally editing them.

    Project is acting weird. When I try to close a form and save edits, it won't close. Odd.
    Last edited by June7; 11-17-2011 at 10:48 PM.
    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: 5
    Last Post: 10-13-2011, 03:36 PM
  2. Replies: 7
    Last Post: 07-15-2011, 01:58 PM
  3. Replies: 3
    Last Post: 06-03-2011, 08:58 AM
  4. Charts within subform in a control source
    By GraemeG in forum Forms
    Replies: 0
    Last Post: 06-03-2011, 04:38 AM
  5. Auto Populating Field in Subform
    By sparlaman in forum Forms
    Replies: 21
    Last Post: 03-28-2011, 12:58 PM

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