Hey all;

I have a formula set up that checks if a date from the database is between a certain range - IE between 1st April 2007 and 31st March 2008.

However, at the end of that period - 31st March 2008, I'll need to change this range to 1st April 2008 - 31st March 2009. This formula is repeated for several entries.

I'm fairly new to Crystal, so I was just wondering if there was any way I could declare and populate just two strings in one place, and then refer to these strings in the rest of the formulas, eg:
vb Code:
  1. Public StringFrom as string
  2. Public StringTo as string
  3.  
  4. StringFrom = "01/04/2007"
  5. StringTo = "31/03/2008"
  6.  
  7.  
  8. '   If Date of CP12 falls after 1st of April 2007
  9. if DateDiff("y", StringFrom, {data.cp12 date}) > 0 then
  10. '   If Date of CP12 falls before 31st March 2008
  11. if datediff("y", StringTo, {data.cp12 date}) < 0 then
  12. '   tally it up
  13. formula = 1
  14. else
  15. end if
  16. else
  17. formula = 0
  18. end if

I've tried that, but Crystal says that "a date is required here".

Help?