Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection between two date ranges

Status
Not open for further replies.

bernie321

Programmer
Jan 7, 2004
477
GB
Hi

We have a report that we need to restrict selection by Two date parameter values: FromDate and ToDate.

The database fields include a startdate and duration (in days).

How can I ensure that all records are selected including when the startdate is before the FromDate and the startdate + duration is after the ToDate.

Thanks

B
 
Try this


{Table.date} in
minimum([{?FromDate},{Table.StartDate}]) to
maximum([{?ToDate},({Table.StartDate}+{Table.Duration})])

Enclose in Parenthesis if in Record selection

(
{Table.date} in
minimum([{?FromDate},{Table.StartDate}]) to
maximum([{?ToDate},({Table.StartDate}+{Table.Duration})])
) and
blah blah blah

Cheers,
-LW

 
Assuming you want to show records that are active at any time during the parameter range, try:

dateadd("d",{table.duration},{table.startdate}) >= {?FromDate} and
{table.startdate} <= {?ToDate}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top