Results 1 to 5 of 5
  1. #1
    jaarons is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    22

    Controlling forms from more than one table

    I have another question. For the purposes of this question, I have three tables:
    Students
    Guardians
    Students and Guardians


    Students has ID, First Name, Last Name
    Guardians has ID, First Name, Last Name


    Students and Guardians has Student (Primary Key, linked to Students -> ID), Guardian ID (Primary Key, linked to Guardians -> ID), Relationship (Combo box with values like mother, father, etc), Lives With Child (Yes/No box) and Emergency Contact (Yes/No box)

    Now I also have four forms
    StudentsAdd
    StudentsView
    GuardiansAdd
    GuardiansView


    Students forms are identical with the same fields as the tables, but StudentsView is set to Modal->No and has Next record, previous record buttons. StudentsAdd is set to Modal->Yes and has save record, cancel record buttons.

    Guardians forms are the same.

    Ok, so here's the question. I want to link the information in the Students and Guardians table to the GuardiansView form.

    Specifically,

    In StudentsView, I want a text box showing all guardians listed in the Students and Guardians table as having a relationship with that student. I want to see the relationship text box as well as the two yes/no fields.

    In GuardianView, I want a text box showing the student listed in the Students and Guardians table as having a relationship with that guardian. Again, I want to see the relationship text box as well as the two yes/no fields.

    Thanks for any help you might have!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Your post title doesn't make sense. Forms are not controlled from tables. Forms are bound to tables/queries.

    Yes, more than one form can use the same table/query as RecordSource.

    A textbox would show only one value, not 'all guardians'. To show 'all' would require a combobox, listbox, or subform.

    It is possible to use same form for both adding and viewing records (1 for Students and 1 for Guardians).

    A form/subform for data entry is probably what you need. Two options.

    1. Main form bound to Students and subform bound to StudentsGuardians

    2. Main form bound to Guardians and subform bound to StudentsGuardians
    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
    jaarons is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    22
    Sorry, I'm still new to Access, so bear with me. I have the following form for Students (see pic)

    EDIT: picture removed by moderator.

    I actually like that I have seperate forms for data entry and for viewing. That's all set up. What I want is a field on this form that says Guardians and that any guardians linked to this student (by studentID/GuardianID) show up in a text box/list box/whatever.

    How do I do that?

    Tables are:
    Students
    Guardians
    Students and Guardians

    Forms are
    StudentsAdd
    StudentsView
    GuardiansAdd
    GuardiansView

    How do I, as you say, use more than one table/query in a single form. I know I can click Add Existing Fields, Show All Tables and choose the Students and Guardians table, but how do I make sure that for each record, only the guardian/s assigned to the student come up in the field?

    Thanks!
    Last edited by June7; 01-03-2013 at 01:08 PM.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    To show the guardians for a student would require a combobox, listbox, or subform.

    A combobox or listbox would have a RowSource with filter criteria that is dependent on the Student ID of the current record and would require code to refresh the box when navigating records.

    A subform records would synchronize with the student record by setting the Master/Child links of the subform container control.

    I removed the image you attached to post because it looked like real data.
    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
    jaarons is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    22
    Thanks. No it was fake data since I was posting it, but thanks for being careful. Hmmm. I'll have to experiment. Thanks anyway.

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

Similar Threads

  1. Controlling the window size of a pop up form
    By Aaron5714 in forum Forms
    Replies: 5
    Last Post: 11-29-2012, 01:23 PM
  2. Replies: 12
    Last Post: 08-26-2012, 02:09 PM
  3. Controlling subform resize
    By Deutz in forum Forms
    Replies: 2
    Last Post: 10-13-2011, 07:35 PM
  4. Controlling autonumber
    By Patience in forum Access
    Replies: 3
    Last Post: 06-22-2010, 04:11 AM
  5. Checkbox controlling text box
    By chuckduarte in forum Forms
    Replies: 0
    Last Post: 10-21-2008, 10:45 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