Queries and Dates Issue

G

Guest

I have a query problem. I have a field that does a calculation in the form
that I have. When I open the form it calculates the numbers of days to
maturity based on today date. I use the following "formula" in the form
field: =[LeaseMaturityDate]-Now() . The form field is a text box.

I need to write a query where the in can input the number of days to
maturity for any given record. That is, I want to get all those records
that are 210 days from maturity.

Any suggestions?

Thank you for your help

Walter H.
 
G

Graham R Seach

Walter,

This should do it.

Create a new column to replace your formula:
DaysToMaturity: DateDiff("d", [LeaseMaturityDate], Now())

....then in the criteria box, enter:
=210

This should return all the records whose date to maturity = 210.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
G

Guest

Thank you Graham. Your suggestion worked for me. However I did have to
transpose the formula you gave to DaysToMaturity: DateDiff("d",
Now(),[LeaseMaturityDate]). This way I get a negative number for any record
that has a martuity date prior to today.
Thanks again. :)


Graham R Seach said:
Walter,

This should do it.

Create a new column to replace your formula:
DaysToMaturity: DateDiff("d", [LeaseMaturityDate], Now())

...then in the criteria box, enter:
=210

This should return all the records whose date to maturity = 210.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia


Walter H said:
I have a query problem. I have a field that does a calculation in the form
that I have. When I open the form it calculates the numbers of days to
maturity based on today date. I use the following "formula" in the form
field: =[LeaseMaturityDate]-Now() . The form field is a text box.

I need to write a query where the in can input the number of days to
maturity for any given record. That is, I want to get all those records
that are 210 days from maturity.

Any suggestions?

Thank you for your help

Walter H.
 

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