NOOFDAYS: Diff2Dates("md",(select min(dateofs) from details),(select
max(dateofs) from details),True)
Gives me the result . for ex. 10 months 8 days
but i have 10 month 12 days and in the first month i miss 4 days.
is it possible to rectify.
:
Try the "More Complete DateDiff Function" Graham Seach and Doug Steele
wrote.
http://www.accessmvp.com/djsteele/Diff2Dates.html
You specify how you want the difference between two date/times to be
calculated by providing which of ymdhns (for years, months, days,
hours,
minutes and seconds) you want calculated.
You can make 314 days return 10 months and 14 days IF you decide that
every
month is 30 days long.
314\30 & " Months" & 314 mod 30 & " days"
one of my query is like this..i paste the sql
SELECT DISTINCTROW Format$(details.dateofS,'mm yyyy') AS [dateofS By
Month],
details.stid, Sum(details.petrol) AS [Sum Of petrol], (select
max(dateofS)
from details)-(select min(dateofs) from details ) AS NOOFDAYS
FROM details
GROUP BY Format$(details.dateofS,'mm yyyy'), details.stid
HAVING (((details.stid)=[Forms]![searchfrm]![stidcmb]));
here NOOFDAYS GIVES ME 314 days but my boss ask me to display..
10 month and 14 days ....in the report header....
:
Dear is:
The value you seem to be requesting could be added to your query by
adding a
column. This value would show up in every row of the subsequent
query
results, and would be the same value in every row.
I recommend using a subquery such as this:
(SELECT MAX(dateofS)
FROM YourTable) -
(SELECT MIN(dateofS)
FROM YourTable)
AS DateDifference
If you have difficulty adding this to your query, please post the
rest
of
the query you have and I'll try to add it.
Tom Ellison
in my Query i have the following fields
dateofS,stationName,PetrolSales...
dateofS field have date values like 02/09/2005,
03/09/2005.....etc.
in my report and chart (yearly report and monthly report) i have
to
display
no.of months and also days. exactly.(because some time data not
available
for all dates in that month) kindly please help me..in this
issue.
Thanks