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

Between Days Crystal Formula 1

Status
Not open for further replies.

Meg09

Technical User
Jan 30, 2009
14
US
Hello,

I am trying to write a Crystal Report formula for a report that will would be scheduled to run automatically each month and provide associates who were hired between the 2nd up until the last day of the month for the prior month.

So for example, if I ran the report as of the 6th of December, I am trying to capture those associates who were hired between the 2nd & 30th of November. Again, the report would be scheduled to run automatically with no parameters input by any users.

Any suggestions would be greatly appreciated.

Thanks,
Meg
 
create 2 formulas

for the first date you need (the 2nd of previous month), use:
//{@Start}
dateserial(year(currentdate),month(currentdate)-1,2)

for the second date you need (last of previous month), use:
//{@End}
dateserial(year(currentdate),(month(currentdate)-1)+1,1)-1

then in your selection critiera, the {Table.Date} would be in [{@Start} to {@End}]

I do not have crystal in front of me but the above should be close.
 
Well,, if the field is actually a "date" field,, you can just subtract one field from the other to get the number of days difference. Otherwise, you can manipulate the string, convert it to a date field and then do the calculation.
 
Thank you fisheromacse. Your formula worked; my report is pulling the correct dates. [ponytails]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top