Results 1 to 14 of 14
  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419

    form - record source - select a table

    Form - record source - select a table that when the user enter a value in the field of the form
    it gets place into the designated table (select a table).



    my problem is that I have two fields in the form, one field from the data entry is suppose to go to the train table,
    and another field the data entry is suppose to go to the station table.

    How can this be done?

    if I have the form's record source have a designated table for the data entry.
    It doesn't have two tables for the data entry. Thanks!!! :-)

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    How about joining the two tables together in a query, and then using the query as the source of your Form?
    Then you should be able to update both tables at once.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    That might work depending on table relationships but only if records already exist in both tables. Won't allow creating records in the tables.

    Basically, a form should be entering/editing data for only one table. Perhaps you really should be using a form/subform arrangement for this.

    Describe table relationships.
    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.

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    That might work depending on table relationships but only if records already exist in both tables. Won't allow creating records in the tables.
    Yes, I was a bit hasty, and should have said that it will only work under certain conditions.

    However, there are certain conditions in which you can add new records to both tables at the same time. For example, if the two tables are joined on an Indexed fields that does not allow duplicates, it will work.

  5. #5
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Quote Originally Posted by JoeM View Post
    How about joining the two tables together in a query, and then using the query as the source of your Form?
    Then you should be able to update both tables at once.
    This would update the query, not the original table right? That is what I think will happen.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Query is based on table(s). If the query is editable then the edits will pass to table.
    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.

  7. #7
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Describe table relationships.
    booking, bookingLeg, and linestation.

    bookingID is FK to passenger by cid PM
    bookingLEG is bookingID is FK to booking PM bookingID, and it's startID and endID is FK to the PM stationID station table.
    linestation lineID is FK to linein line table PM and linestation stationID is FK to stationID line table PM.
    trainid from train table is join with bookingleg tid

    my bookingleg trainID combo box is suppose to update the trainID in the train table, and the start station and end station from the bookingleg form in the combo box is suppose to update the
    bookingleg table's startID and endID.

    so with this relation you think the join table, and query could be updated to the train table and the bookingleg table?


    Here is a picture!! Thx


    Click image for larger version. 

Name:	11-13-13.png 
Views:	13 
Size:	25.2 KB 
ID:	14381

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Think I see circular reference relationships. Could be an issue. Review http://www.codeproject.com/Articles/...atabase-Design

    and https://www.accessforums.net/forms/a...ect-39272.html
    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.

  9. #9
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    This would update the query, not the original table right? That is what I think will happen.
    To follow up on what June said, it is important to understand what queries are, they are not separate entities from the tables. They are just different "views" into your tables.
    So, when you update data in a query, you are really updated the underlying data in a table.
    By definition, it would be physically impossible to update something in a query, and not have it update the underlying table.

  10. #10
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Think I see circular reference relationships. Could be an issue.
    Ok thanks for pointing that out. Didn't know much about circular reference, and I am not a modeling expert (wish I am) but from what
    I have gather, I think circular reference means when you have an entity that is reference to two other entities and one of the referenced
    entity is also reference to the other entity or reference to another entity that is reference to the other entity.

    example: entity A, entity B, entity C, entity D

    entity D is reference to entity A and C
    entity C is reference B who is reference to A and this is a circular reference.

    Thanks for pointing that out, I made a change and got rid of the line table so now I have this.

    Click image for larger version. 

Name:	11-14-13.png 
Views:	10 
Size:	30.1 KB 
ID:	14396

  11. #11
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    To follow up on what June said, it is important to understand what queries are, they are not separate entities from the tables. They are just different "views" into your tables.
    So, when you update data in a query, you are really updated the underlying data in a table.
    By definition, it would be physically impossible to update something in a query, and not have it update the underlying table.
    Ok thanks for letting me know of this.
    So I created a query, I called it trainANDbookingleg

    and this is the query:

    Code:
    SELECT tid, startid, endid
    FROM trains INNER JOIN bookingleg ON trains.trainid = bookingleg.tid;
    I am going to use this as the row source, but I am still not sure how I can update two table (the train and bookingLeg) by this?

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Still suggest you limit a form to one table for data entry/edit. Use form/subform arrangements.
    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.

  13. #13
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Quote Originally Posted by June7 View Post
    Still suggest you limit a form to one table for data entry/edit. Use form/subform arrangements.
    Ok I will try that, never done a form and subform arrangement yet. too many things to try and test out.
    Thanks!!!

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    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. Change/select record source of subreports
    By TerriLynnG in forum Reports
    Replies: 2
    Last Post: 08-24-2013, 10:18 AM
  2. Replies: 3
    Last Post: 02-06-2013, 07:23 PM
  3. Replies: 3
    Last Post: 08-19-2012, 12:12 PM
  4. Replies: 4
    Last Post: 05-09-2012, 07:20 AM
  5. Replies: 2
    Last Post: 11-29-2010, 11:16 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