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.
Need Total Amount Due in my database
Collapse
X
-
Enter this (fill in the table name) in the SQL view of a new query:
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.Code:SELECT Paid, Sum([Ticket Amount]) AS [Sum Of Ticket Amount] FROM [Table Name here] GROUP BY Paid HAVING (Paid)=False));
-
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
Comment