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

    If Then Math

    I seem to have backed myself into a bit of a corner and Need some help with "IF THEN" math, please



    In the image below I have tried to Show the Form, Table, and Query that I'm working with. (and I'm not sure if this math belongs in the qry or the form??)

    I am tracking Fines and need to total the amount of fines paid using the "Date Paid" field as the criteria.

    something like

    = IF ("DatePaid"= Value) then (sum "FineAmount")

    Thanks for the helpClick image for larger version. 

Name:	Capture.PNG 
Views:	26 
Size:	66.5 KB 
ID:	43403

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    try something like

    =DSum("FineAmount","tblFines","TransCode = " & forms!...... & " and DatePaid is not null")

    What happens with a partial payment?
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Hi James,

    In the (totals) query you could use PaidFine:= Sum(IIF (Not Isnull([DatePaid]), [FineAmount],0))

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    or perhaps

    sum((isnull([date paid])+1)*fineAmount)

  5. #5
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    In tbl_Fines, you have a field for "FineAmount" but you do not have a field for "FinePaidAmount".
    As Moke123 pointed out, there could be partial payments. So you need a field for Fine Paid Amount.

    Or you could use the "FineAmount" field, but add aouther field for "Fine" or "Payment". This means redesigning the tbl_Fines table

  6. #6
    Tuckejam is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    168
    I know adding a "PaidAmount" wound more easily solve the problem, however as I said I kind of backed myself into a corner and would also need to redesign a bunch of qrys forms and reports to support a "paidamount"

    the reason I got here is because in the last 3 years no one has ever made a partial fine payment, well.... actually in the last 3 years no on has every actually paid a fine.
    the group votes to fine the chapters that didnt bring their paperwork or pay their dues on time. and then after a few months when everyone has racked up a bunch of fines they vote to waive all the fines and start over.

    honestly herding cats would be easier

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

Similar Threads

  1. Math Game
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 12-26-2019, 05:34 PM
  2. IIF statement + some math
    By jirakst in forum Access
    Replies: 6
    Last Post: 09-25-2015, 10:41 AM
  3. Form Math
    By PSpingola in forum Forms
    Replies: 3
    Last Post: 03-28-2011, 09:29 PM
  4. bad math again
    By newtoAccess in forum Access
    Replies: 1
    Last Post: 12-03-2010, 12:19 AM
  5. Math problem
    By kbrodrick in forum Programming
    Replies: 3
    Last Post: 05-06-2009, 08:56 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