Hi
I have a Reading table with some water readings. the Table consistes of ID, customer=text,Reading_Date=Datetime Picker,Reading=Number.
Also have a Reading_Summury query that selects data from the Customer Table which Displays Information pulled From The reading table Which Works fine The User will have to inter the month and year to be displayed.
Now I would like to add the reading for the previous month (1 month previous the month the user entered. Every attempt I try I get asyntax error.
This is my last atempt.
Code:
SELECT Reading_tbl.Reading_Date AS RD, PLAZA.plzName AS Plaz, Customer.[Meter#] AS [Account Code], Customer.cusName AS Account, Customer.UNIT, Customer.CustShort, Customer.[Meter#], Customer.Meter_Size, Reading_tbl.Reading AS [Current], MAX.MaxOfReading AS [MAX], Min.MinOfReading AS [MIN], DateAdd("m",-1,[rd]) AS LMonth, (Select
[Reading_qry].Reading
From
[Reading_qry]
Where
[Reading_qry]].[date_Read] = DateAdd("m", -1, [Reading_tbl]].[Reading_Date])
And
[Reading_qry].Account = [Reading_tbl].Customer)
FROM ((((PLAZA LEFT JOIN Customer ON PLAZA.plzID = Customer.CustPlaza) LEFT JOIN Reading_tbl ON Customer.cusName = Reading_tbl.Customer) LEFT JOIN [MAX] ON Customer.custID = MAX.custID) LEFT JOIN [Min] ON Customer.custID = Min.custID) LEFT JOIN Reading_qry ON Customer.cusName = Reading_qry.Account
WHERE (((Format([Reading_Date],"m/yy"))=[Month/Year]));