Results 1 to 3 of 3
  1. #1
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038

    Requery controls on subform #2 when making a change on subform #1

    Good morning:

    I am hopeful someone may provide some assistance with "re-querying" a control (subform 2) when making a change on subform 1.

    I reviewed the following site but I've been unable to identify the correct property/control reference:
    http://access.mvps.org/access/forms/frm0031.htm

    Allow me to provide some background first:
    - Form "F01_MainMenu" = parent/main form
    - Form "F02_First_Half" = subform #1
    - Form "F02_First_Half_Subtotals" = subform #2

    Process:
    - Upon opening "F01_MainMenu", locate 4th field [AMOUNT] in subform #1
    - Let's focus on 1st record ([PAYEE] = "Utility Company") where [AMOUNT] = $75
    - Now, subform #2 shows the subtotals for [ACCOUNT_NUM] "0001" and "0002" equal to $95 and $55, respectively.
    - Also, in subform #2's footer, I also display the SUBTOTAL of all account numbers (e.g., $150) as well as the "floating budget" (delta between paycheck of $1000 - the subtotal).

    Current Process:

    - As of now, the subtotal and floating budget in subform #2 are correctly calculated.

    What Currently does NOT work:
    - If I were to change the amount (in subform #1) from, e.g., "$75" (Utility Company) to $100, the values in subform #2 are NOT updated.
    - That is, subform #2 should immediately show the following changes:

    1. [ACCOUNT_NUM] = "0001" should change from $95 to $120
    2. [SUBTOTAL] should change from $150 to $175
    3. [FLOATING BUDGET] should change from $850 to $825

    Current VBA (which does NOT work):


    - On subform #1 ("F02_First_Half"), I added an OnCurrent event various line of code. Unfortunately, neither of them are working to accomplish the update.

    Code:
    Private Sub Form_Current()  
       Forms![F01_MainMenu]![F02_First_Half_Subtotals].Form.Requery
       
       OR
       
       Forms!F01_MainMenu!F02_First_Half.Form!F02_First_Half_Subtotals.Requery
       
    End Sub
    My question:
    What VBA needs to be included (and on which form/subform) IOT to update the various $$ amounts on subform #2 when updating/changing the [AMOUNT] value in subform #1?
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Not with Current event.

    Have to first commit record edits to table. Have to reference subform through subform container and in this case, really just need to reference container, which you have named Query5.


    Private Sub AMOUNT_AfterUpdate()
    Me.Dirty = False
    Me.Parent.Query5.Requery
    End Sub
    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
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038
    Thank you June7. That works.

    I appreciate the help!

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

Similar Threads

  1. requery 1 subform after activity on another subform
    By markjkubicki in forum Programming
    Replies: 5
    Last Post: 10-24-2019, 03:29 PM
  2. Can't Change Back Color of Subform Controls
    By ItsRoland in forum Access
    Replies: 5
    Last Post: 05-28-2019, 11:57 AM
  3. Replies: 4
    Last Post: 03-06-2015, 12:38 AM
  4. Field Change to requery/refresh subform!
    By DubCap01 in forum Forms
    Replies: 3
    Last Post: 01-07-2015, 10:13 PM
  5. Replies: 3
    Last Post: 04-17-2012, 10:28 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