E
eddieK
Want to create query showing orders 30 60 90 days overdue. would like to
calculate these dates without vba....tku 2003 or 2007
calculate these dates without vba....tku 2003 or 2007
John Spencer said:You can use an expression like the following to calculate in a query the
number of days overdue.
Date()-[SomeDateField]>=90
Date()-[SomeDateField]>=60 AND Date()-[SomeDateField]<90
Date()-[SomeDateField]>=30 AND Date()-[SomeDateField]<60
That will return true or false. If you want the True/False to appear in as a
value in a query and you are using the design view to build the query, you
would enter something like the following to return -1 (90 Days overdue), Not
90 days overdue.
Field: Over90: Date()-[SomeDateField]>=90
If you want to do that in one field, then you would need and expression like
the following. All on one line, but entered here with line feeds to make it
easier to read.
IIF(Date()-[SomeDateField]>=90, "OverDue 90",
IIF(Date()-[SomeDateField]>=60 AND Date()-[SomeDateField]<90,"Overdue 60",
IIF(Date()-[SomeDateField]>=30 AND Date()-[SomeDateField]<60,"OverDue 30",
"Current")))
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Want to create query showing orders 30 60 90 days overdue. would like to
calculate these dates without vba....tku 2003 or 2007
John:
tku for the quick reply. I was able to run the quert successfully. However
is there a way to only show the records that are >90 days, rather that
displaying all records90)records. Also, instead of showing -1 in the
calculated field, can yes be displayed.
John Spencer said:You can use an expression like the following to calculate in a query the
number of days overdue.
Date()-[SomeDateField]>=90
Date()-[SomeDateField]>=60 AND Date()-[SomeDateField]<90
Date()-[SomeDateField]>=30 AND Date()-[SomeDateField]<60
That will return true or false. If you want the True/False to appear in as a
value in a query and you are using the design view to build the query, you
would enter something like the following to return -1 (90 Days overdue), Not
90 days overdue.
Field: Over90: Date()-[SomeDateField]>=90
If you want to do that in one field, then you would need and expression like
the following. All on one line, but entered here with line feeds to make it
easier to read.
IIF(Date()-[SomeDateField]>=90, "OverDue 90",
IIF(Date()-[SomeDateField]>=60 AND Date()-[SomeDateField]<90,"Overdue 60",
IIF(Date()-[SomeDateField]>=30 AND Date()-[SomeDateField]<60,"OverDue 30",
"Current")))
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Want to create query showing orders 30 60 90 days overdue. would like to
calculate these dates without vba....tku 2003 or 2007
John Spencer said:Use an expression like:
IIF(Date()-[SomeDateField]>=90,"Yes",Null)
And if you are talking about limiting the records to just those over or = to
90 day. Add the datefield into your query (again if needed) and set the
criteria to
<DateAdd("d",-89,Date())
That will only return records where your field is over 90 days from today.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
John:
tku for the quick reply. I was able to run the quert successfully. However
is there a way to only show the records that are >90 days, rather that
displaying all records90)records. Also, instead of showing -1 in the
calculated field, can yes be displayed.
John Spencer said:You can use an expression like the following to calculate in a query the
number of days overdue.
Date()-[SomeDateField]>=90
Date()-[SomeDateField]>=60 AND Date()-[SomeDateField]<90
Date()-[SomeDateField]>=30 AND Date()-[SomeDateField]<60
That will return true or false. If you want the True/False to appear in as a
value in a query and you are using the design view to build the query, you
would enter something like the following to return -1 (90 Days overdue), Not
90 days overdue.
Field: Over90: Date()-[SomeDateField]>=90
If you want to do that in one field, then you would need and expression like
the following. All on one line, but entered here with line feeds to make it
easier to read.
IIF(Date()-[SomeDateField]>=90, "OverDue 90",
IIF(Date()-[SomeDateField]>=60 AND Date()-[SomeDateField]<90,"Overdue 60",
IIF(Date()-[SomeDateField]>=30 AND Date()-[SomeDateField]<60,"OverDue 30",
"Current")))
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
eddieK wrote:
Want to create query showing orders 30 60 90 days overdue. would like to
calculate these dates without vba....tku 2003 or 2007
the first methow worked great!. however, i messed up the second instruction.
When entered with the <dateadd, i received an error message 'expression
contains invalid data". i am using DueDate field to store dates and used
9/1/2009.
If i remove the < then the query runs, but shows a date of
of 9/26/2009 in the calculation field.
Thank you for your help.
John Spencer said:Use an expression like:
IIF(Date()-[SomeDateField]>=90,"Yes",Null)
And if you are talking about limiting the records to just those over or = to
90 day. Add the datefield into your query (again if needed) and set the
criteria to
<DateAdd("d",-89,Date())
That will only return records where your field is over 90 days from today.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
John:
tku for the quick reply. I was able to run the quert successfully. However
is there a way to only show the records that are >90 days, rather that
displaying all records90)records. Also, instead of showing -1 in the
calculated field, can yes be displayed.
:
You can use an expression like the following to calculate in a query the
number of days overdue.
Date()-[SomeDateField]>=90
Date()-[SomeDateField]>=60 AND Date()-[SomeDateField]<90
Date()-[SomeDateField]>=30 AND Date()-[SomeDateField]<60
That will return true or false. If you want the True/False to appear in as a
value in a query and you are using the design view to build the query, you
would enter something like the following to return -1 (90 Days overdue), Not
90 days overdue.
Field: Over90: Date()-[SomeDateField]>=90
If you want to do that in one field, then you would need and expression like
the following. All on one line, but entered here with line feeds to make it
easier to read.
IIF(Date()-[SomeDateField]>=90, "OverDue 90",
IIF(Date()-[SomeDateField]>=60 AND Date()-[SomeDateField]<90,"Overdue 60",
IIF(Date()-[SomeDateField]>=30 AND Date()-[SomeDateField]<60,"OverDue 30",
"Current")))
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
eddieK wrote:
Want to create query showing orders 30 60 90 days overdue. would like to
calculate these dates without vba....tku 2003 or 2007
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.