Results 1 to 4 of 4
  1. #1
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94

    Adding Records in a Subform

    I have a primary form which contains the Pk for table "tickets"

    On that form, I need to create subform which displays multiple records from the "images" table.

    The relationship between the tables is 1-M, Tickets-Images.



    How do I go about creating a subform which would allow me to associate all new records to the ticketID field? Additionally, all fields in the subform for Images would be dropdown selections based on relationships from other tables.

    The sample Assets db for Access 2010 has the functionality I need in the Asset List and Contact List forms, but I am not understanding the details of it.

    Thanks...

  2. #2
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by chris.williams View Post
    I have a primary form which contains the Pk for table "tickets"

    On that form, I need to create subform which displays multiple records from the "images" table.

    The relationship between the tables is 1-M, Tickets-Images.

    How do I go about creating a subform which would allow me to associate all new records to the ticketID field? Additionally, all fields in the subform for Images would be dropdown selections based on relationships from other tables.

    The sample Assets db for Access 2010 has the functionality I need in the Asset List and Contact List forms, but I am not understanding the details of it.

    Thanks...
    Since your "TicketID" is the primary key for the table, "ticket", you will need a foreign key field in the Image table to receive the "TicketID". This two fields should be your relationship between the tables to create a one to many relationship: one TicketID from your Ticket Table to many Foreign-TicketID in the image table. You then create a sub form based on the image table and link the "parent/child" relation between the main form to the subform via the TicketId/Foreign-TicketId fields

  3. #3
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    Thanks - but I have already created the FK - I just forgot to mention it. What I am referring to is how do I go about adding records in the sub-table, it only displays them.

  4. #4
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by chris.williams View Post
    Thanks - but I have already created the FK - I just forgot to mention it. What I am referring to is how do I go about adding records in the sub-table, it only displays them.
    You can change the property of the sub form to allow edits, deletions, and additions. If you can allow records to directly enter into the subform, the foreign key will automatically take on the primary key value because the parent/child link you have. Another way would be using an entry form. To have the foreigh key set to the primary key, you can set the default value of the entry form's foreign key to that of the main form's primary key

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

Similar Threads

  1. execute code on subform without adding a record
    By markjkubicki in forum Forms
    Replies: 5
    Last Post: 10-13-2011, 12:23 PM
  2. Adding totals to a form from a subform
    By Niki in forum Access
    Replies: 13
    Last Post: 05-13-2011, 12:17 AM
  3. Replies: 10
    Last Post: 01-10-2011, 07:52 PM
  4. After adding data on subform
    By Nancy in forum Forms
    Replies: 9
    Last Post: 12-22-2010, 06:19 PM
  5. Adding multiple records in subform
    By randolphoralph in forum Programming
    Replies: 1
    Last Post: 05-12-2010, 09:42 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