Results 1 to 5 of 5
  1. #1
    Tuckejam is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    168

    Calculated Field in form


    sorry if this seems like a double post, I know it is closely related to my "Calculated Column" post in queries. but I have other issues with forms as well

    I have a simple math problem

    FineAmount - AmountPaid = AmountDue

    in the form (subform) I have totaled the the amounts in the subform footer


    Total Fines Total Paid Amount Due
    =Sum([qry_Fines]![FineAmount]) =Sum([qry_Fines]![AmountPaid]) ????????







    whats really odd is when i use this formula in the amount due textbox =sum( [FINEtotal] - [FINEpaid] )

    it voids the other two formulas in Total Fines and Total Paid and all 3 boxes return #ERROR

    How can I get the form to do the simple math of A-B=C

    Thanks for the help

    Click image for larger version. 

Name:	Capture.PNG 
Views:	19 
Size:	24.2 KB 
ID:	43411

    Click image for larger version. 

Name:	Capture2.PNG 
Views:	19 
Size:	27.3 KB 
ID:	43412
    Click image for larger version. 

Name:	Capture3.PNG 
Views:	19 
Size:	14.3 KB 
ID:	43413

  2. #2
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Total Fines: =Sum([FineAmount])
    Total Paid: =Sum([AmountPaid])
    Total Due: =Sum([FineAmount])-Sum([AmountPaid])

  3. #3
    Tuckejam is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    168
    That Worked! Thank You!!! (and I understand the layout better now, I still always think of formulas in excel format)

    bonus question: with the other formula, why did it error out the other two "total" and "Paid" fields just by simply referencing them in the formula?

  4. #4
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Quote Originally Posted by Tuckejam View Post
    That Worked! Thank You!!! (and I understand the layout better now, I still always think of formulas in excel format)
    You are welcome!

    Quote Originally Posted by Tuckejam View Post
    bonus question: with the other formula, why did it error out the other two "total" and "Paid" fields just by simply referencing them in the formula?
    Sorry, I have no idea!...

  5. #5
    Join Date
    Apr 2017
    Posts
    1,681
    Quote Originally Posted by Tuckejam View Post
    bonus question: with the other formula, why did it error out the other two "total" and "Paid" fields just by simply referencing them in the formula?
    The formula must work when you refer to form controls instead, like = Nz(txtTotalFines,0) - Nz(txTotalPaid,0). And remember, when any field/control is empty, the formula returns an error unless you take care of it - I used Nz() in my example here for this.

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

Similar Threads

  1. Replies: 4
    Last Post: 02-09-2019, 05:38 PM
  2. Replies: 1
    Last Post: 05-22-2017, 05:59 AM
  3. Replies: 2
    Last Post: 12-30-2014, 01:32 PM
  4. Replies: 1
    Last Post: 08-25-2014, 01:23 PM
  5. Replies: 1
    Last Post: 04-21-2013, 03:20 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