Results 1 to 4 of 4
  1. #1
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    57

    populate multiple tables from one form?


    Hi im new to access but im making good progress in making a database but was wondering if it was possible to populate two tables from one input form. Not all the data on the form will go into both tables .Some info into one table and other info into the other ...much appreciate any help...or am I missing an easier way to do what I want to achieve

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    The general rule in relational databases is 'one-form-one-table.' If there is a relationship, especially a one-to-many relationship, between the two Tables, data input can be done using a Main Form (the 'one' side of the relationship) with a Subform on it based on a Form for the 'many side' Table. As you move through Records on the Main Table, the Records in the Subform update, accordingly. This is accomplished by there being a common Field shared by the two Tables, usually an ID type Field that is the Primary Key of the Main Form Table and a Foreign Key Field in the Subform's Table.

    For more detailed help, you're going to have to give us much more detail, best done with a 'plain language' description' of what you're trying to accomplish.

    Welcome to the forum!

    Linq ;0)>

  3. #3
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    57
    Thanks ive just realised I can do what need to achieve from a query. Great forum thanks

  4. #4
    DubCap01 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Location
    Dubbo, Australia
    Posts
    104
    Hi Chr1stoper1
    Sometimes I find that queries bloat a database. Not because they are big in size, it's just that you end up with so many queries it's hard to keep up with what exactly they do.
    Myself, I use this code (below) instead of running a query to append new records to a table. If I need to append some of this data to another table, I just run it again! (see example)
    Example:
    Dim Rs As Recordset
    Set Rs = CurrentDb.OpenRecordset("TblWhatever1", dbOpenDynaset)
    Rs.AddNew
    Rs![Field1] = Me.Field1
    Rs![Field2] = Me.Field2
    Rs.Update
    Rs.Close
    Set Rs = Nothing
    then, to add records to another table, I just use the same code but change the recordset number:
    Dim Rs1 As Recordset
    Set Rs1 = CurrentDb.OpenRecordset("TblWhatever2", dbOpenDynaset)
    Rs1.AddNew
    Rs1![Field1] = Me.Field1
    Rs1![Field2] = Me.Field2
    Rs1.Update
    Rs1.Close
    Set Rs1 = Nothing

    Hope that helps

    Pete

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

Similar Threads

  1. Using forms to populate multiple tables
    By Geocink in forum Forms
    Replies: 1
    Last Post: 05-22-2014, 04:44 AM
  2. Replies: 7
    Last Post: 01-22-2014, 11:30 AM
  3. One form to populate multiple tables
    By justair07 in forum Forms
    Replies: 5
    Last Post: 11-19-2013, 01:49 PM
  4. Replies: 1
    Last Post: 10-28-2012, 07:23 PM
  5. Replies: 4
    Last Post: 01-20-2011, 10:05 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