Results 1 to 2 of 2
  1. #1
    jamarogers is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Location
    Mendenhall, MS
    Posts
    19

    Code updates only 1 (1st) related record

    My struggle continues...Here's my code:

    1) Me.SOCusFName = Me.SOCusLName.Column(1)
    2) Me.SOShipCost.SetFocus


    3) Forms![SOs]![SODisc] = DLookup("[Discount]", "Customers", "[CusLName] = Forms!SOs!SOCusLName And [CusFName] = Forms!SOs!SOCusFName")
    4) Me.Recalc
    5) Me.Requery
    6) Forms![SOs]![SOItems]![SOItDisc] = Me.SODisc * Forms![SOs]![SOItems]![SOItPrice]
    7) Me.Requery
    8) Me.Recalc

    My logic: If SOCusLName changes, a new SODisc (3) is retrieved and this part works fine. In (6) I wish to recalculate ALL records in the SubForm based on this new SODisc value in the MainForm...this works, BUT ONLY for the 1st record in the SubForm...remaining records remain unchanged. Help please...
    Jake

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    This would be clearer
    Code:
    3) Forms![SOs]![SODisc] = DLookup("[Discount]", "Customers", "[CusLName] = " & Me.SOCusLName & " And [CusFName] = " & Me.SOCusFName )
    To recalculate all records in the subform, you're going to need an UPDATE query.

    You'll have to tell us the criteria for selecting records for the subform - such as linkfields, and are there filters? Then we can suggest ways to cause the mass update.

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

Similar Threads

  1. Replies: 7
    Last Post: 07-02-2012, 10:50 PM
  2. Combobox selection updates Table record
    By lucky in forum Access
    Replies: 4
    Last Post: 10-30-2011, 10:44 AM
  3. Inquiry form updates the current record
    By mazzanrol in forum Forms
    Replies: 4
    Last Post: 04-08-2011, 08:35 AM
  4. Ideas on shorter code for cascading updates
    By usmcgrunt in forum Programming
    Replies: 3
    Last Post: 12-03-2010, 12:17 PM
  5. Replies: 2
    Last Post: 03-29-2010, 11:52 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