Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku Search messages from lefora.com (free forums) Lefora
My account: Login | Sign Up
Loading... 

Thread: datediff()

Started 1 month, 2 weeks ago by Myysterio
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?
Site: Access World Forums  Access World Forums - site profile
Forum: General  General - forum profile
Total authors: 4 authors
Total thread posts: 25 posts
Thread activity: no new posts during last week
Domain info for: access-programmers.co.uk

Other posts in this thread:

DCrake replied 1 month, 2 weeks ago
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

Myysterio replied 1 month, 2 weeks ago
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.

DCrake replied 1 month, 2 weeks ago
apart from not being a mind reader, a number can't be <=0 AND >=2 Why not if expr<> 1 David

Myysterio replied 1 month, 2 weeks ago
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...

Brianwarnock replied 1 month, 2 weeks ago
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

Myysterio replied 1 month, 2 weeks ago
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 ...

Brianwarnock replied 1 month, 2 weeks ago
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

Myysterio replied 1 month, 2 weeks ago
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 ...

DCrake replied 1 month, 2 weeks ago
Try putting an extra set of brackets around the mathmatical part of the filter so that this will be processed first. Think BODMAS. David

Myysterio replied 1 month, 2 weeks ago
Done, no go. Still is returning a weird result.

 

Top contributing authors

Name
Posts
Myysterio
12
user's latest post:
datediff() - Page 2 - Access...
Published (2009-11-03 07:43:00)
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.
DCrake
8
user's latest post:
datediff() - Page 2 - Access...
Published (2009-11-03 07:29:00)
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 ???
Brianwarnock
4
user's latest post:
datediff() - Page 2 - Access...
Published (2009-11-03 08:06:00)
You are right Namliam, I guess I was so pissed off at repeating myself I lost my rag and didn't answer properly. Brian
namliam
1
user's latest post:
datediff() - Page 2 - Access...
Published (2009-11-03 07:52:00)
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&lt;2 and X&gt;0 That is in more proper terms X&gt;0 and X&lt;2 I agree if it says X&lt;0 and X&gt;2, this is not possible should be OR... X&lt;0 or X&gt;2

Related threads on "Access World Forums":

Related threads on other sites:

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