Results 1 to 8 of 8
  1. #1
    ilikebirds is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    14

    Subform Calculations: Totals

    In the following image I have two subforms filtering to the selection of Township Combo.


    In the Subform on the bottom I would like TOTAL FUNDS to calculate information from other fields in the row and update when I select the UPDATE Phases button.

    What is the best practice for this? I've been racking my head over how to get the data into that subform field and then saved.

    Basically Total Funds = Fund1 + Fund2
    Click image for larger version. 

Name:	billing.PNG 
Views:	15 
Size:	21.4 KB 
ID:	10417

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Don't understand. Don't see any fields named Fund1 and Fund2.

    Why save calculated results that can easily be calculated in a query whenever needed?

    Similar named fields indicates data is not 'normalized'. Will never have more than 3 phases?
    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
    ilikebirds is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    14
    Correct no more than the alloted phases.
    I have it so that TotalFunds updates, but I am trying to get all the records in the subform to update through a button on the parent form. But I can not get it to work.
    Dim rs As DAO.Recordset
    Set rs = Me.Billingsubform.Form.RecordsetClone

    With rs
    .MoveFirst
    Do While Not .EOF
    .Edit
    !TotalFunds = Nz([Calc1], 0) + Nz([Calc2], 0) + Nz([calc3], 0) + Nz([calc4], 0) + Nz([calc5], 0)
    .update
    .MoveNext
    Loop
    End With
    Set rs = Nothing

    Billingsubform being the subform name

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Never done anything like this.

    Where are Calc1, etc. coming from?

    Again, why save the TotalFunds calculated results?
    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
    ilikebirds is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    14
    That's a good question. I Think we should just query all of that information and bring it to the subform.

    calc1 was coming from the subform in the "Form Footer" so it doesn't show.

    However if it is done through query - what if the user has to manually adjust 'Total Funds'?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Manually adjust a calculated value?

    You have 5 textboxes in a footer that are summed and you want that value saved to every record?

    I am going in circles here. Do not understand what you want to do.

    Want to provide db for analysis? Follow instructions at bottom of my post.
    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.

  7. #7
    ilikebirds is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    14
    No your suggestion of doing a query was perfect. But now I'm having trouble with one of the query expressions:

    Phase1: IIf(Eval([case terminated date] Is Null And [certificate of eligibility] Is Null),0,IIf(Eval([case terminated date]>0 And [certificate of eligibility]>0 And [case terminated date]>[Certificate of eligibility]),[phase].[phase1],0))

    The first nested iif works fine, and the truepart of the second nested is fine, however the False part throws an ERROR. Any Idea?

  8. #8
    ilikebirds is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    14
    I figured out why I was getting errors. 1. The field was type currency - So I changed it to text
    Phase1: IIf(Eval([case terminated date] Is Null And [certificate of eligibility] Is Null),0,IIf([certificate of eligibility]>0 And [case terminated date]>[Certificate of eligibility],[phase].[phase1],IIf([case terminated date] Is Null And [certificate of eligibility]>0,[Phase].[Phase1],"Term")))

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

Similar Threads

  1. Form/Subform Calculations
    By sidewayzalex in forum Forms
    Replies: 0
    Last Post: 08-15-2011, 01:11 PM
  2. Subform, Totals, in Datasheet view
    By eww in forum Programming
    Replies: 1
    Last Post: 09-27-2010, 10:22 AM
  3. subform calculations
    By genesis in forum Forms
    Replies: 0
    Last Post: 12-03-2009, 07:18 PM
  4. Subform calculations
    By foureyes in forum Forms
    Replies: 4
    Last Post: 07-27-2009, 08:20 AM
  5. Subform and calculations issues
    By rustyCrVx in forum Access
    Replies: 1
    Last Post: 05-02-2009, 03:37 PM

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