Return a total based on user inputted date and location

BBK

Registered User.
Local time
Today, 07:10
Joined
Jul 19, 2010
Messages
71
I want to create a query that by entering a 'Location' and a specific time frame eg Jan 21- Dec 12 it will return the total amount paid/received on that Location during that time frame.


(Enter a location
Enter a beginning date
Enter a end date

And the query to return the 'Total Amount Paid' for that 'Location' during the dates entered.)

1tsgsn.jpg


Code:
SELECT tblProperty.Address, Sum(tblPayment.AmountPaid) AS SumOfAmountPaid
FROM tblProperty INNER JOIN (tblLease INNER JOIN tblPayment ON tblLease.TenantID = tblPayment.TenantID) ON tblProperty.PropertyID = tblLease.PropertyID
GROUP BY tblProperty.Address
HAVING (((tblProperty.Address) Like "*" & [Enter Location:] & "*")) AND (((tblPayment.DatePaid) Between [Enter the beginning date:] And [Enter the end date:]));


Having big problems with this one, any help or advice gladly accepted and appreciated.
 
Try

Code:
SELECT tblProperty.Address, Sum(tblPayment.AmountPaid) AS SumOfAmountPaid
FROM tblProperty INNER JOIN (tblLease INNER JOIN tblPayment ON tblLease.TenantID = tblPayment.TenantID) ON tblProperty.PropertyID = tblLease.PropertyID
WHERE (((tblPayment.DatePaid) Between [Enter the beginning date:] And [Enter the end date:]) AND ((tblProperty.Address) Like "*" & [Enter Location:] & "*"))
GROUP BY tblProperty.Address;


Brian
 
Once agan Brian you have saved the day.

Thanks a million for the help
 

Users who are viewing this thread

Back
Top Bottom