D
desertdirk
Hi
I don't have much experience with this.
How do I get all the records from the last month in a table? I have
tried dateadd("m",-1,date()) but that does not return any records. This
is a complex query with 2 calculated fields and uses 2 tables and a
query. SQL code is below, without the criteria for last month.
SELECT TblsiteID.siteNumber, TblsiteID.customerId,
TblsiteID.rentalType, meterRead.readDate, meterRead.meterReading,
[meterRead Query].MaxOfmeterReading, [QryPrimaryReading Query].rate,
[meterRead Query]![MaxOfmeterReading]-[meterRead]![meterReading] AS
usage, [rate]*[usage] AS amountDue
FROM [QryPrimaryReading Query], TblsiteID INNER JOIN ([meterRead Query]
INNER JOIN meterRead ON [meterRead Query].siteNumber =
meterRead.siteNumber) ON (TblsiteID.siteNumber = meterRead.siteNumber)
AND (TblsiteID.siteNumber = [meterRead Query].siteNumber)
WHERE (((TblsiteID.rentalType)="leased tenant"))
ORDER BY TblsiteID.siteNumber, meterRead.readDate;
I am trying to get the last month from meterRead.readDate.
Am I trying to pack too much into one query?
Thanks
I don't have much experience with this.
How do I get all the records from the last month in a table? I have
tried dateadd("m",-1,date()) but that does not return any records. This
is a complex query with 2 calculated fields and uses 2 tables and a
query. SQL code is below, without the criteria for last month.
SELECT TblsiteID.siteNumber, TblsiteID.customerId,
TblsiteID.rentalType, meterRead.readDate, meterRead.meterReading,
[meterRead Query].MaxOfmeterReading, [QryPrimaryReading Query].rate,
[meterRead Query]![MaxOfmeterReading]-[meterRead]![meterReading] AS
usage, [rate]*[usage] AS amountDue
FROM [QryPrimaryReading Query], TblsiteID INNER JOIN ([meterRead Query]
INNER JOIN meterRead ON [meterRead Query].siteNumber =
meterRead.siteNumber) ON (TblsiteID.siteNumber = meterRead.siteNumber)
AND (TblsiteID.siteNumber = [meterRead Query].siteNumber)
WHERE (((TblsiteID.rentalType)="leased tenant"))
ORDER BY TblsiteID.siteNumber, meterRead.readDate;
I am trying to get the last month from meterRead.readDate.
Am I trying to pack too much into one query?
Thanks