Results 1 to 7 of 7
  1. #1
    rmoore is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    Feb 2020
    Posts
    47

    Criteria of Calculated field

    I have a query "qAmountOwed" with a calculated field [RemainingBalance]. I need to set the criteria to show the records that are greater than $1.



    I have tried: >1
    >"1"
    >
    $0.00
    >"
    $0.00"

    Nothing seems to work

    Also I cant figure out why the "Enter the Parameter" box opens when I run it.

    Any suggestions?
    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
    53,648
    Can't reference an aggregate field in the same query it is calculated. Try:
    Code:
    SELECT tLoans.LoanNumber, tLoans.AmountOwed, Sum(tPayments.PaymentAmount) AS SumOfPaymentAmount, [AmountOwed]-Sum([tPayments].[PaymentAmount]) AS RemainingBalance, [FirstName] & " " & [LastName] AS FullName
    FROM (tCustomers INNER JOIN tLoans ON tCustomers.CustomerID = tLoans.CustomerID) INNER JOIN tPayments ON tLoans.LoanNumber = tPayments.LoanNumber
    GROUP BY tLoans.LoanNumber, tLoans.AmountOwed, [FirstName] & " " & [LastName]
    HAVING ((([AmountOwed]-Sum([tPayments].[PaymentAmount]))>0))
    ORDER BY [FirstName] & " " & [LastName];
    
    Why is PaymentAmount field in multiple tables?
    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
    rmoore is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    Feb 2020
    Posts
    47
    I will change that. PaymentAmount in tLoans records the payment "expected/required" calculated from the loan amount, number of payments and interest. The "other" PaymentAmount is to record the actual payment made, I use that one to calculate the remaining balance.

    I realize there are many ways to structure the DB to accomplish the same thing. Do you see a better way of doing this to simplify other aspects?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Okay, would just suggest to make names slightly different. Don't use exactly same field name in multiple tables.
    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
    rmoore is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    Feb 2020
    Posts
    47
    Thanks June7... Where do I use the code you suggested?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    It's a query. It is a modification of the query you built. Switch to SQLView to see SQL statement. Copy/paste mine. Then switch to DesignView.
    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
    rmoore is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    Feb 2020
    Posts
    47
    Thanks..... worked like a charm.... and it fixed the paramiter value box from popping up

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

Similar Threads

  1. Calculated field based on criteria being true
    By Giles64 in forum Programming
    Replies: 15
    Last Post: 11-28-2019, 03:45 AM
  2. Replies: 6
    Last Post: 12-08-2016, 02:44 PM
  3. Replies: 3
    Last Post: 02-26-2015, 11:01 AM
  4. Replies: 5
    Last Post: 07-02-2014, 07:13 AM
  5. Setting criteria in a calculated date field
    By SteveReberger in forum Access
    Replies: 0
    Last Post: 10-29-2008, 06:58 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