Results 1 to 5 of 5
  1. #1
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    Trouble with using a form to update a table

    The attached Word file shows screen shots of what I am dealing with. I have two tables called Roster and Balance that are related. The first record in the Roster table has the name "Ali Arnold."



    The Balance table is blank.

    I also have a form called Balance which is bound to the Balance table. The Balance form has only two fields, first name and last name. I entered Ali for the first name, and Arnold for the last name. And I get an error message saying "You cannot add or change a record because a related record is required in table 'Roster.'

    So I am entering values in the form which are definitely in the Roster table.

    By adding "Ali Arnold" I am adding something for which there is already a related record in the Roster table. I don't understand why I am getting this error.Access Question.zip
    Last edited by Access_Novice; 10-25-2013 at 10:36 PM. Reason: Transposition error with message.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,618
    Because you shouldn't save names in Balance, save the gymnastID. gymnastID is the primary key so should be saved as foreign key in Balance. Do not repeat names in Balance, that is duplication of data.

    Also, really shouldn't keep 'balance' data anyway. An account balance should be calculated based on the net aggregate sums of all transaction records (obligations - payments = balance). http://allenbrowne.com/AppInventory.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.

  3. #3
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Thank you June7. I understand what you mean by foreign key and duplication of data. The reason why I had names appearing in the balance table in addition to the roster table, is because I want the user to enter payment information into the balance form and with that enter the gymnast's name. I wanted them to enter the gymnast's name because that would be easier than entering the gymnast ID. Is there anyway around this?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,618
    Use combobox to select gymnast by name but save the ID.

    Combobox properties:

    RowSource: SELECT gymnastID, LastName & ", " & FirstName As GymnastName FROM Roster;

    BoundColumn: 1

    ColumnCount: 2

    ColumnWidths: 0";2"
    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.

  5. #5
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Got it. Thanks June7.

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

Similar Threads

  1. Replies: 7
    Last Post: 09-21-2012, 11:09 AM
  2. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  3. Replies: 1
    Last Post: 09-08-2011, 06:36 PM
  4. Replies: 1
    Last Post: 07-27-2010, 08:02 AM

Tags for this Thread

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