Skip to Content
Former Member
Jul 26, 2013 at 06:25 PM

Passing a Range Parameter to a Subreport


I have a report that takes two parameters, Year and Period. Year is a two digit value and Period is a range between 1 and 12. The record selection formula contains the code something like this:

{MyTable.GL_Year} = {?Year}


{MyTable.GL_Period} In {?Period}

The report has a subreport which should have the parameters passed to it which I did with the "Change Subreport Links" Then, in the Record Selection Formula of the subreport, I change the code to look like this:

{MyTable.GL_Year} = {?Pm-?Year}


{MyTable.GL_Period} In {?Pm-?Period} ("In" replaces the "=" that Crystal originally had created)

Checking the code, I get an error that a range is required. Changing it back to "=", I don't get an error, but I get no records displayed. Checking the SQL, I see that there is no GL_Period in the WHERE clause. Running the SQL in MSSMS, it runs, but I'm getting data for periods that should have been filtered out.

So, what am I doing wrong? And, more importantly, how do I do it right?