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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Date...Pls 1

Status
Not open for further replies.

eastwestk

Programmer
Jun 10, 2009
39
US
Hello,

I have a report with 3 parameters such as startdate, enddate and country

When the user set the startdate and enddate as null and entering only country then
I want to display the startdate and enddate as yesterday's date and for this I created a formula as follows and if enddate is null then it should display enddate as today's:

if isnull({?@STARTDATE}) and isnull({?@ENDDATE}) then

"Batch Date Range: " + totext(Date(DateAdd("d",-1,CurrentDate))) + " thru " + totext(Date(DateAdd("d",-1,CurrentDate)))

else if isnull({?@ENDDATE}) then

"Batch Date Range: " + totext(Date({?@StartDate})) + " thru " + ToText(CurrentDate)

else
"Batch Date Range: " + totext(Date({?@StartDate})) + " thru " + totext(Date({?@EndDate}))

But when both startdate and enddate are nulls then my formula is not displaying yesterday's date. And I have this formula in Page Header section.

Any ideas?

Thank You!


 
its because you second condition is also true

try

if isnull({?@STARTDATE}) and isnull({?@ENDDATE}) then

"Batch Date Range: " + totext(Date(DateAdd("d",-1,CurrentDate))) + " thru " + totext(Date(DateAdd("d",-1,CurrentDate)))

else if isnull({?@ENDDATE}) and not(isnull({?@STARTDATE})) then

"Batch Date Range: " + totext(Date({?@StartDate})) + " thru " + ToText(CurrentDate)

else
"Batch Date Range: " + totext(Date({?@StartDate})) + " thru " + totext(Date({?@EndDate}))

Ian
 


It's working only when I am de-selecting the check boxes in Report Options for
Convert Database Null Values to default and
Convert Other Null Values to default

But with the above settings some columns in the report is displaying null values and If I am selecting the check boxes for the above then I see the values in columns.

Any suggestion please.

Thank You!
 
Just uncheck Convert Other Null Values to default
and leave database values checked.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top