Results 1 to 2 of 2
  1. #1
    GAJITCS is offline Novice
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    4

    Update Query to update values of a sub form (BOM)

    I have a simple BOM.



    There are three tables
    Assemblies - It contains the fields: AssemblyID, Description and On Hand
    Parts - Contains many fields, relevant are: PartID and On Hand
    BOM - Assembly ID, PartID and Number Required

    Assembly:AssemblyID is a One to Many relationship to BOM:AssemblyID
    Parts:PartID is a One to Many relationship to BOM:PartID

    I have a form that happily shows an Assembly with a subform showing the component parts.
    I have a field on that form where I can enter a value by which I can execute an update query to increase the On Hand value of the Assembly by the number specified.

    What I am struggling with is the query that will then decrease the On Hand values of the component parts shown on the query.

    The logic I have says along the lines of Table:Parts:OnHand-(Form:Assemblies:Text10*Form:BOM:Number Required)

    In essence, if the captured value in Text 10 is 2, and the Number Required for the first entry on the BOM Components list was 3, then the On Hand value for the component would need to be reduced by (2*3)=6.
    There after, for each of any other components, the calculation would be the same, On Hand = Text10*Number Required.

    Is there a way of completing this task?

    Would it be helpful if I posted more detail? and what would you need?

    Many thanks.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    strongly recommend you do not save the on hand value - calculate it as and when required.

    Reason is that if an error occurs, it will be impossible to resolve. By error I mean a record is deleted, a quantity changed, the order of events are changed etc.

    You should have a table of transactions which records quantities in and quantities out. Plenty of examples out there, just google 'BOM system design considerations' or similar.

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

Similar Threads

  1. Replies: 10
    Last Post: 07-14-2021, 02:08 PM
  2. Can't update values in a select query
    By clancy76 in forum Access
    Replies: 4
    Last Post: 01-28-2021, 01:05 PM
  3. Replies: 4
    Last Post: 09-24-2019, 02:56 PM
  4. Replies: 15
    Last Post: 10-18-2015, 04:05 PM
  5. Update query to summarize multiple values
    By ser01 in forum Queries
    Replies: 3
    Last Post: 05-15-2010, 09:38 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