Date problems

ecorg911

Registered User.
Local time
Today, 15:27
Joined
Jan 7, 2009
Messages
14
Hi, I am currently trying to get a query to only output data that was "added" to a table in the last three months.

I have produced the following, although it is a poor way of getting round the problem. Could someone help me create a more efficient query. E.g. so the database would automatically know the current date etc.

Code:
Between #01/09/2008# And #01/01/2009#

Any help would be greatly appreciated.

Thanks :)
 
Try

Between Date() - 90 and Date()

or use the DateAdd function to get better precision on the 3 months than 90 days.
 
If it is always going to be 3 months ... well, there are several ways you can do this - here is one.

In the QBE, in another column add the following ..

Code:
DateDiff("m",[DateAddedFieldName],Date())

where DateAddedFieldName is the date field you are wishing to key off of. Then, in the criteria of that column, place ..

Code:
<3

This is aircode, please test before fully trusting.

-dK
 
Thank you both for your input =), I will try out these methods now and let everyone know the results :)

Edit: tried pbaldy's solution and works great thanks!

I would have tried DK's, but I think it's a little beyond my knowledge of access ^_^ Thanks :)
 
Hehehe ... is okay, I was simultaneously posting and just threw one out there.

Regardless of how you got the answer, you got an answer and it is working for you. Thanks for responding!

-dK
 
Muah-ha-ha, victory is mine! :p

As dk said, the important thing is you got an answer that works for you. Typically there are numerous ways of accomplishing a goal.
 

Users who are viewing this thread

Back
Top Bottom