Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    OTOTO is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Location
    Massachusetts
    Posts
    37

    Query-populating form updates individual table attributes, applies to all records-wtf


    I have form attached to query. When I edit information about records in the form, the table where the information resides updates and the update affects all other records. Rather than assigning a new primary key and creating a new record in the table and assigning that to the record that I'm editing, the attribute for the original key changes, and all other records referencing that same key show the changed attribute in the forms. Perhaps this is an end-of-the day wall I'm hitting. Seems obvious, but I could use some assistance. Thanks.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If you have a form that is using a query as its Record Source, it is possible to update data in more than one table at a time. If your query has two tables and the JOIN creates a One to Many relationship, you could possibly update multiple records (on the Many side) in one fell swoop. It has been a while since I designed a form this way.

    Consider the query and the JOIN. Then consider which field you are updating from within the form. Is this control bound to the table on the Many side?

  3. #3
    OTOTO is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Location
    Massachusetts
    Posts
    37
    hi itsme, thanks for the reply
    I'm not sure what you mean by "is the control bound to the table on the many side?"

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    The way I understand it is that you are typing data into a control. You are doing this while in Single Form view of a form. You expect the data you are inputting to appear in one record within the tables. Instead, the same data is appearing in multiple rows/records.

    Can you isolate a single control on a form where this phenomenon is occurring? What is the name of the field this control is bound to? What is the name of the table that this field resides in? Is this table on the many side of your JOIN?

  5. #5
    OTOTO is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Location
    Massachusetts
    Posts
    37
    Quote Originally Posted by ItsMe View Post
    The way I understand it is that you are typing data into a control. You are doing this while in Single Form view of a form. You expect the data you are inputting to appear in one record within the tables. Instead, the same data is appearing in multiple rows/records.

    Can you isolate a single control on a form where this phenomenon is occurring? What is the name of the field this control is bound to? What is the name of the table that this field resides in? Is this table on the many side of your JOIN?
    HI,

    I'm looking at a form which I've created. One of the controls is a text box called TotalRetentionPeriod. All of the form content is coming from a query which was set up automatically by Access when I imported the data and broke it into various tables.

    The view of the query relationships looks like this (I don't see the one and many sides as I would expect from this auto-generated query): See Attachment


    The Query's relationship properties looks like this for the relationship in question: See Attachment
    Attached Thumbnails Attached Thumbnails 7-10-2014 10-06-52 AM.jpg  

  6. #6
    OTOTO is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Location
    Massachusetts
    Posts
    37
    Additionally, I'd like to throw in the image of the relationships which DOES show that the many and one relationships:

    Click image for larger version. 

Name:	7-10-2014 10-11-00 AM.jpg 
Views:	12 
Size:	122.2 KB 
ID:	17203

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    What happens when you type data into your control on your form, the control that is bound to TotalRetentionPeriod?

  8. #8
    OTOTO is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Location
    Massachusetts
    Posts
    37
    Hi,

    When I type data into the control on the form, it accepts the data as a change to that attribute in the tblTotalRetentionPeriod rather than creating a new primary key ID for the new attribute or assigning a different ID to the record in the event that it is an already-occurring attribute. I figured that this would be built in logic

  9. #9
    OTOTO is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Location
    Massachusetts
    Posts
    37
    more: I created this form by creating by going to the one side table of tblBusinessFunctionNames and then adding to it the subform which is a form created from the query of all the tables. I thought that in this way, maybe the changes roll up to the 1 table and apply to many but this is the case even in the subform when it is viewed as a standalone form.

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by OTOTO View Post
    ... When I edit information about records in the form, the table where the information resides updates and the update affects all other records...
    Is this what happens when you type data into your control on your form, the control that is bound to TotalRetentionPeriod?

  11. #11
    OTOTO is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Location
    Massachusetts
    Posts
    37
    yes it is what happens when I type data into the control that is bound to TotalRetentionPeriod

  12. #12
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    It is probably not relevant for this discussion but, your JOINS in your query appear to be LEFT joins. This, by itself, is not a big issue. However, your relationships are defined as tblRetentionCode... being the table with the Many records.

    I suggest you use either an INNER join or a RIGHT join. The difference between LEFT and RIGHT is very confusing because it has to do with which table you name first withinin the statement. Fortunately Access can give you a GUI to help you decide if you need RIGHT or LEFT.

    From within the query builder in Design View, double click the line that connects two of the tables. Choose the option, Include all Records from tblRetentionCode...

    This will give you the correct join to display the Many side appropriately. Another option would be an INNER join. This is created when you select the option to Include records from both sides where the value is equal, or wording close to that. To recap, there are three options. The option you have selected is not appropriate. The INNER join is usually best suited for viewing data, eg reports. The LEFT or RIGHT joins are better for data entry, typically.

    Now on to the relationships Window. You can create relationships here that will help to enforce referential integrity. This is done by applying Constraints at the table layer. From within the relationships window, you can double click the line that connects the two tables to edit constraints.

    I suggest you fix the JOIN type for your query and then move to the relationships window to edit the Constraints. Understand that all of this may or may not impact how your form updates data in your table. However, understanding these points and using your knowledge to create the correct Constraints and queries will be beneficial when you create forms.

  13. #13
    OTOTO is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Location
    Massachusetts
    Posts
    37
    You mean this property or the Right-To-Left versus Left-To-Right "Orientation"?

    Click image for larger version. 

Name:	7-10-2014 12-29-02 PM.jpg 
Views:	10 
Size:	40.8 KB 
ID:	17206

  14. #14
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I would not be so concerned about the orientation as much as choosing one of the Radio Buttons. If you adjust the table names in the Pull Down Menus the description of the Radio Buttons will change. By simply focusing on the Radio Buttons, you do not need to be concerned whether RIGHT or LEFT is employed.

    Include ALL records from the table with Many

  15. #15
    OTOTO is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Location
    Massachusetts
    Posts
    37
    Thanks ItsMe. I was able to update the radial button relationships so that the query runs as I would expect
    Current status:
    Trying to get the parent tables and references to update correctly.
    Attached Thumbnails Attached Thumbnails 7-15-2014 8-22-47 AM.jpg  

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-15-2013, 02:21 PM
  2. Replies: 6
    Last Post: 08-07-2012, 02:44 PM
  3. Form text box updates for all records
    By AndrewsPanda in forum Forms
    Replies: 13
    Last Post: 09-28-2011, 11:31 PM
  4. Replies: 3
    Last Post: 01-25-2011, 09:50 AM
  5. individual records in same column on form
    By Sharron in forum Forms
    Replies: 0
    Last Post: 10-04-2008, 09: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