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!

"# of days till due" -- How to get values to return?

Status
Not open for further replies.

Hawk45

Programmer
May 29, 2002
32
US
I am creating a report that I need to return the # of days till a project is due. I have this currently:

if CurrentDate - DTSToDateTime ({reports.modifieddate})>120
then "Past Due"
else "OK"

I want to change the "Past Due" part to " This is due in x days". How can I do this. Do I need to create a seperate formula to respond to "Past Due" ?

Your help is appreciated.

Thanks,

Hawk
 
Hawk,

You might want to try changing your formula to this;

whileprintingrecords;
numbervar DaysTilDue := CurrentDate - date({Field});

"Due in " + totext(DaysTilDue,0) + " days."

Naith
 
Naith,

Thanks that worked well, but I need to have the variable render to >120 such as:

numbervar DaysTilDue := CurrentDate - date({ALL_Ideas_for_Crystal2._18}) >120 ;
"Due in " + totext(DaysTilDue,0) + " days."

When I do this it asks for a number in front of the CurrentDate. Maybe I am asking the wrong thing.

What I want this to do is Subtract the Current Date minus the modifiedDate, if it is greater or equal to 120 days show "# days till due", otherwise show as "ok".
If it is over 130 days to say "removed"

How can I accomplish this?

Thanks again for all of your help,

Hawk
 
Okay, let's tweak it so it looks like:

//Start//

whileprintingrecords;
numbervar DaysTilDue := CurrentDate - date({Field});

if DaysTilDue >= 130 then "Removed"
else
if DaysTilDue >= 120 then
"Due in " + totext(DaysTilDue,0) + " days."
else
"Okay"

//End//

You'll have to guinea pig this, I'm afraid, as I haven't tested it - but it should be the moneyshot.

Naith
 
Naith,

You da man! Worked like a charm.

Thanks for all your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top