View Full Version : Date querys


plasma
03-31-2008, 10:16 AM
Hello all! need some here here.

I'm making a Item db where the items have expiration dates, and what I'd like to have is a report that will show items that have expired and items that will expire in 1 month. For some reason I'm stuck getting started, could anyone point me in the right direction?

thanks..

pbaldy
03-31-2008, 12:14 PM
Use the DateAdd function to add a month, and test for records less than that.

plasma
04-04-2008, 11:00 AM
Use the DateAdd function to add a month, and test for records less than that.


would I do that in the Table, Query or ? and could you please give me a little more explanation on how to set this up? from what I can tell, I can specify the dateadd to look for a specific month, but how would I set it up so it so it compares the expiration date to the current date

thx

pbaldy
04-04-2008, 11:49 AM
You could do it in a query, with a criteria on the expiration date field of:

< DateAdd("m", 1, Date())

plasma
04-04-2008, 11:52 AM
You could do it in a query, with a criteria on the expiration date field of:

< DateAdd("m", 1, Date())

If tried this, but for some reason it's coming up with no results. I'll keeps hacking away and see if something works..

thx

pbaldy
04-04-2008, 11:53 AM
Post a sample db if you can't figure it out.

plasma
04-07-2008, 05:06 AM
Post a sample db if you can't figure it out.

I am unable to upload anything from work, but maybe I can explain and someone can get me started..


Tables:
Products
Just 4 columns, with an example

Product ID Product Name Lot Number Expiration Date
1 Standard1 976-3na 05/25/08
2 Standard2 522618 08/01/08



For the Report, I would like something that would show me the Products that will expire within the next month plus Products that have expired.


Again, I am sorry I cannot upload what I have (can't at work) but basically it's the same as what I posted above. I tried doing the DateAdd("m", 1, Date()) but I had no luck

thx for any help..

pbaldy
04-07-2008, 08:36 AM
Is Expiration Date a date/time field in the table?

plasma
04-07-2008, 08:57 AM
Is Expiration Date a date/time field in the table?

yes, it's a date/time field, although the time does not matter.

pbaldy
04-07-2008, 09:05 AM
Then I'm stumped, because I tested that criteria on a database of mine and it worked as expected. Can you post the full SQL of the query you tried?