I think I spent enough time for this problem. I feel like I am spinning the wheel and getting nowhere. I hope you guys can help me.
What I intented to do is to query how much water pumped out of each pump within a given datetime range. Pretty simple right? You take the last record minus the first record of the date time range you entered, right?
Here is my query in sql view
SELECT Abs(Last(Tran_Lift1_Acre_Ft.Tran_Lift1_Pump1)-First(Tran_Lift1_Acre_Ft.Tran_Lift1_Pump1)) AS [Pump 1 Acre-Ft]
FROM Tran_Lift1_Acre_Ft
WHERE (((Tran_Lift1_Acre_Ft.DateNTime) Between [Forms]![DateTime Parameters]![StartDate] And [Forms]![DateTime Parameters]![EndDate]));
I found this query works only if I enter a short date range (from yesterday to today) If I query from last week to today, it will give me the wrong number.
I've tried to strip down my query to
SELECT Last([Tran_Lift1_Acre_Ft].[Tran_Lift1_Pump1]) AS [Pump 1 Acre-Ft]
FROM Tran_Lift1_Acre_Ft
WHERE (((Tran_Lift1_Acre_Ft.DateNTime) Between [Forms]![DateTime Parameters]![StartDate] And [Forms]![DateTime Parameters]![EndDate]));
it would still give the wrong answer.
Note: my datetime format is like this 9/27/2007 11:44:58 PM same as the datetime format is my table.
any idea?
What I intented to do is to query how much water pumped out of each pump within a given datetime range. Pretty simple right? You take the last record minus the first record of the date time range you entered, right?
Here is my query in sql view
SELECT Abs(Last(Tran_Lift1_Acre_Ft.Tran_Lift1_Pump1)-First(Tran_Lift1_Acre_Ft.Tran_Lift1_Pump1)) AS [Pump 1 Acre-Ft]
FROM Tran_Lift1_Acre_Ft
WHERE (((Tran_Lift1_Acre_Ft.DateNTime) Between [Forms]![DateTime Parameters]![StartDate] And [Forms]![DateTime Parameters]![EndDate]));
I found this query works only if I enter a short date range (from yesterday to today) If I query from last week to today, it will give me the wrong number.
I've tried to strip down my query to
SELECT Last([Tran_Lift1_Acre_Ft].[Tran_Lift1_Pump1]) AS [Pump 1 Acre-Ft]
FROM Tran_Lift1_Acre_Ft
WHERE (((Tran_Lift1_Acre_Ft.DateNTime) Between [Forms]![DateTime Parameters]![StartDate] And [Forms]![DateTime Parameters]![EndDate]));
it would still give the wrong answer.
Note: my datetime format is like this 9/27/2007 11:44:58 PM same as the datetime format is my table.
any idea?