Date Query

P

Pearl

I would like to set a query whereby I will locate data that will occur on a
future date. That is, if I have a date field with 01/01/1999 and that data
element will Expire 3 years after that date, how can I find that data that is
true for "date + 3years later"?

I don't have any programming knowledge so I can't use SQL queries. Is
there a way in a query that I can do something like [Date]+3 or the like and
get a dataset from the table?
 
J

Jerry Whittle

You need to use the DateAdd function. Something like below will add 3 years
to the [date] field. You could use something like that in the field of a
query in the QBE grid or even in the criteria.

DateAdd("yyyy",3,[date])

BTW: "date" is a very bad name for a field. It's a reserved word as Access
has a Date() function. Always remember to up [] around it and in the future
names such fields a little differently, like TheDate, so Access doesn't get
confuses. You can read more about reserved words at:
http://support.microsoft.com/kb/286335/
 
P

Pearl

many thanks. this was very helpful information.

Jerry Whittle said:
You need to use the DateAdd function. Something like below will add 3 years
to the [date] field. You could use something like that in the field of a
query in the QBE grid or even in the criteria.

DateAdd("yyyy",3,[date])

BTW: "date" is a very bad name for a field. It's a reserved word as Access
has a Date() function. Always remember to up [] around it and in the future
names such fields a little differently, like TheDate, so Access doesn't get
confuses. You can read more about reserved words at:
http://support.microsoft.com/kb/286335/
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Pearl said:
I would like to set a query whereby I will locate data that will occur on a
future date. That is, if I have a date field with 01/01/1999 and that data
element will Expire 3 years after that date, how can I find that data that is
true for "date + 3years later"?

I don't have any programming knowledge so I can't use SQL queries. Is
there a way in a query that I can do something like [Date]+3 or the like and
get a dataset from the table?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top