when I do
Code:
datediff(expr)<=0 and datediff(expr)>=2
and the result being evaluated is 1, why does it not count as true? Better yet, how do I fix it so it does?
You code is wrong
There are three things you need to provide
1 the time value you want to see (days, months, years, etc)
2 the lower date
3 the upper date
Example
Elapsed = DateDiff("d",Date(),[DOB])
This shows the differenc ein days between the date of birht and today.
Form more help type in DateDiff and press F1.
David
I am well aware, I was short handing it cause the info between the parenthesis doesnt appear to matter. I had it set to "m" and "d" and neither worked.
a number cant be both less than 0 and greater than 2 but a result can be both.
plus, the result can be a range of numbers, the key is I am attempting to evaluate one table against multiple logical tests to get records that meet my criteria. the only part that doesnt work is this datediff() issue. I've even plugged the date diff into a query to test the results and evaluate true/false against...
Dear me David you really are a poor mind reader, it was obvious that expr and expr were different otherwise he would have written expr1 and expr2.
why not just <1 and >1 or do we have decimal places involved?
Brian
Edit what is the full formula
actually the expr in the parenthesis are exactly the same. I am just evaluating [date ranges] out of tables vs. the current date to get records within my current criteria.
its something along the lines of =dcount(*, 'tablename', criteria1 and criteria2 and criteria3 and datediff(expr)>X and datediff(expr)<Y)
I don't have the exact code because its at work.
Needless to say, I have got ...
Quote:
Originally Posted by Myysterio
actually the expr in the parenthesis are exactly the same. I am just evaluating [date ranges] out of tables vs. the current date to get records within my current criteria.
Then David's comment in post 4 must stand as both Datediff's will produce the same result.
Brian
but if you datediff("m", [tabledate], date()) in a query, you get a range of dates depending on which value of [tabledate] is being evaluated. I've plugged it into a query, I can clearly see the result it 1 but it is failing a logical evaluation even when I evaluate the query without all the dcount() nonsense.
It also fails when you do the math manually with (now()-[tabledate])/30. You can ...
because X is a result of doing the datediff(expr) function on a record in a report. the datediff() changes in every record. My results are 0-24 across all records, I am just trying to populate a text box with a number on a report.
Come on, lets be honest and try to help me help you. if your results are 1,7,14,8,2,1,4 for the first 4 records then display them as they are appearing Expr1 Expr 2 1 7 14 8 2 1 4 ???
Quote: Originally Posted by Brianwarnock But how can x be less than 2 AND greater than 0 try OR Brian The sample given is actualy X<2 and X>0 That is in more proper terms X>0 and X<2 I agree if it says X<0 and X>2, this is not possible should be OR... X<0 or X>2
Thread profile page for "datediff()" on http://www.access-programmers.co.uk.
This report page is a snippet summary view from a single thread "datediff()", located on the Message Board at http://www.access-programmers.co.uk.
This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity