Results 1 to 5 of 5
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    one to many relatiionship on data entry form

    Hi

    suspect I've gone wrong somewhere



    I have two tables linked by a one to many relationship

    tbl_place has a list of villages

    tbl_baptism has a list of baptisms fo various villages

    so one village can have multiple baptisms.

    So had a bit of trouble creating a form to add anew record so what I did was:

    Using the query wizard ceated a simple query adding all the fields from tbl_villages and tbl_villages.

    I viewed the query in design mode and it is shown as a 1 to 1 relationship

    I then highlighted the saved query and selected the "Create Form" option to give me astarting point.

    I can now add records perfectly and save them but when I view the table tbl_place it is writing a new place for every new record.

    ie I have a village called Chapel Allerton which I expected to see once in the table but be linked to many in the baptism table. Instead I have seeing multiple fields with the value Chapel Allerton.

    I have tried right clicking of the query relationship join and trying the three options but that did not help

    IS this Ok or have I made a mistake?

    thanks

    Ian

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Normally a one-to-many relationship is presented with a form/subform. In your case, the form would be bound to tbl_place, the subform to tbl_baptism. Master/child links keep the subform in sync with the main form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Well, not the way I would do it.

    so one village can have multiple baptisms.
    So you have a FK field in tbl_baptism for tbl_villages.

    Create a new query. Add the table tbl_baptism to the query. Drag the fields to the grid.
    Save the query as "qrybaptism".
    Create a new form. Set "qrybaptism" as the record source.
    Add the fields to the detail section.

    For the tbl_baptism PK field, set the visible property to NO.

    Find the FK field for tbl_villages.
    Change the control from a text box to a combo box. Set the row source property to a query. I would have the PK field for tbl_villages and the village name. Something like "SELECT villageID_PK, VillageName FROM tbl_villages ORDER BY VillageName".

    Save the form.

    When you add a new baptism, enter the info and select the village name from the combo box.

  4. #4
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    update

    Hi Steve

    thanks for the method-ology, went through it today, got lost, then confused and finaly saw where you were coming from and
    realised I was approaching it all wrong my logic was just flawed. followed your logic and it's all working great.

    thanks a lot Ian

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Happy to help...

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

Similar Threads

  1. Replies: 2
    Last Post: 12-11-2015, 02:55 PM
  2. Replies: 3
    Last Post: 02-25-2015, 04:48 PM
  3. Replies: 5
    Last Post: 03-09-2014, 07:16 PM
  4. Replies: 7
    Last Post: 02-08-2014, 12:31 PM
  5. Replies: 5
    Last Post: 08-12-2013, 12:53 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