query dates within query (1 Viewer)

Bladerunner

Registered User.
Local time
Today, 04:44
Joined
Feb 11, 2013
Messages
1,799
I am trying to run a query that among other items checks to see if the Birthdates field of a table Plus 150 Days is less that the present Date(). in the criteria area.


All are shortdate format and fields are DateTime. However, it does not seems to be recognizing the Date(). Since I don't need the time, I have not tried Now()

Question Can I convert the Birthdate field to a number thus allowing an easy arithmatic function to happen and check it against todays date.

Thanks

Blade
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:44
Joined
Aug 30, 2003
Messages
36,128
What is the SQL of your query? Using Date() should work. If you used the Format() function, that would make the result a string.

To your question, a date/time field is actually stored as a number (Double, where the integer represents the date and the decimal portion the time). Things like FieldName + 1 will work.
 

Bladerunner

Registered User.
Local time
Today, 04:44
Joined
Feb 11, 2013
Messages
1,799
Hi Mr. PBaldy: Thanks for your reply. I had been reading several problems that had arisen using the date() in Access and wondered why everything I read appeared to be complicated. There had to be a simpler way. Yes you are right, the Date() works. Guess I needed to get it in the right format.

Date()>[BirthDate]+150, Where Birthdate is the field name and 150 represents an extension of days. Thus a date of #4/2/2014# + 150 is still lower than todays date.

Thanks again
.

Blade.
:D
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:44
Joined
Aug 30, 2003
Messages
36,128
Happy to help!
 

Users who are viewing this thread

Top Bottom