Need Total Amount Due in my database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tmoore5
    New Member
    • Aug 2014
    • 1

    Need Total Amount Due in my database

    I have a table with a Ticket Amount field and a Paid yes/no box. I want an amount due query that will give me a students total amount due from these two fields. I dont know how.
  • GKJR
    New Member
    • Jan 2014
    • 108

    #2
    Enter this (fill in the table name) in the SQL view of a new query:

    Code:
    SELECT Paid, Sum([Ticket Amount]) 
    AS [Sum Of Ticket Amount]
    FROM [Table Name here]
    GROUP BY Paid
    HAVING (Paid)=False));
    Then you have to figure out how you're going to select a student to show. If you switch to the query design view it should be easier to work the rest out. I would probably use an unbound form to select students in a combo or list box and refer to the control in my query, but there are many different approaches you could take.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32661

      #3
      So, think of a query where you GROUP BY the student (StudentID) and you want the sum of all [Ticket Amount]s where [Paid] is False. Something like :
      Code:
      SELECT   [StudentID]
             , Sum([Ticket Amount]) AS [TotalDue]
      FROM     [tblTicket]
      WHERE    (Not [Paid])
      GROUP BY [StudentID]

      Comment

      Working...