Results 1 to 12 of 12
  1. #1
    jhergert is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2024
    Posts
    21

    Subform update after changing field on parent form

    I知 hitting a road block. I have a form with a subform. I would like the subform to change along with a combo box change on the parent form. Right now when I go to change from one record to another I get an error message.

    I know I値l have to probably provide more information.



    Thank you in advance

  2. #2
    Edgar is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    Getting an error when you go from one record to another means you have code reacting to that record change. Show the code where the error is.

    If you want the subform to change after changing a combobox on the parent form, that's usually a Requery that you need to trigger on the combo box after update event.
    Please click on the ⭐ below if this post helped you.


  3. #3
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Can you show the code in the AfterUpdate of the Combobox?
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  4. #4
    jhergert is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2024
    Posts
    21
    I don't have any code on the after update event for the combo box

  5. #5
    jhergert is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2024
    Posts
    21
    Sorry, error was probably not the best thing to say. The message i get is= The record cannot be deleted or change because the table included related record.

  6. #6
    Edgar is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    Your combobox is not properly configured. Post a sample database.
    Please click on the ⭐ below if this post helped you.


  7. #7
    jhergert is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2024
    Posts
    21
    I think i have it attached. Let me know if it isn't there

    The form I am working in is the StructureAssembly form.

    Thank you for your help
    Attached Files Attached Files

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by jhergert View Post
    I知 hitting a road block. I have a form with a subform. I would like the subform to change along with a combo box change on the parent form. Right now when I go to change from one record to another I get an error message.

    I know I値l have to probably provide more information.

    Thank you in advance
    Never mind
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi J

    It is all down to construction of tables.

    Each table should have its own Autonumber to uniquely identify records.

    You are assigning an automumber named "ID" but not setting it as an Autonumber.

    You are using text dataType as an Autonumber.

    Look at the Relationship Diagram and database attached so that you can work out where you are going wrong.
    Attached Thumbnails Attached Thumbnails RI.png  
    Attached Files Attached Files
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  10. #10
    Edgar is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    It appears you're trying to go to another record with that combo box. However, when you modify it, you're trying to modify the primary key of that record. If you attempt that, you get that error, which is Access complaining that child records in your assembly table need that record, that primary key appears there and you're trying to modify it, that's why.

    So, if you want to go to another record, use an unbound combo box and something that triggers the record change with it. Do not try to modify StructureCode, it is the primary key of your table.BOM Master Database Sample.zip
    Please click on the ⭐ below if this post helped you.


  11. #11
    jhergert is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2024
    Posts
    21
    Thank you everyone for your help. I pretty much opened the app and started watching videos on how to develop a database

  12. #12
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi J
    Here with an update to my last example.

    The subform dealing with materials now works as it should.

    Regards

    Mike
    Attached Files Attached Files
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

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

Similar Threads

  1. Replies: 2
    Last Post: 04-08-2015, 04:06 PM
  2. Replies: 7
    Last Post: 10-21-2014, 07:52 PM
  3. Replies: 3
    Last Post: 10-03-2011, 02:33 PM
  4. Replies: 1
    Last Post: 08-11-2011, 06:22 AM
  5. Replies: 2
    Last Post: 10-19-2010, 11:05 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