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

Warning msg while passing parameters from main to sub report

Status
Not open for further replies.

rubinap

Programmer
Aug 26, 2005
6
CA
Hi there

I have got some sort of a wierd problem.

I have a subreport in the main report & am passing the parameters (start date & end date - AS400 number format ) from the main report. When I link the parameters in the main & sub report & run the report - I get an Error/ Warning -

"Failed to open a rowset. Details: HY000:{HiT][HiT ODBC/400][SQL/400][ODBS Error][SQL0128] Use of NULL is not valid"

On hitting the okay button the report is generated.

However if I do not link the parameters in the main & the sub report ( ie I enter the parameter values for the main & the sub report ) then I do not get the warning.

Is there any way to sort out this problem?

rkp
 
That's an ODBC warning, not a Crystal warning.

A date field in the main report should never be a null unless you intentionally state that it be one, so something seems amiss unless you're passing them using code.

Try posting technical information:

crystal version (always post the software used and it's version)
database/connectivity
Example dtaa
Expected output

-k
 
Hi there

I am passing the value for the start & end date from the main report.( I mean the if the value is not entered you get a error msg to enter the value for that parameter).

I am using Crystal Reports 9.2.0.448.

rkp
 
Crystal defaults to values for dates, so it still doesn't make sense to me.

Anyway, one solution that comes to mind is to set a default value of some absurd date, such as:

1/1/1970

then modify your record selection in the main and subreport to something like:

(
if {?startdate} <> cdate(1970,1,1) then
{table.field >= {?startdate}
and
{table.field <= {?enddate}
else
if {?startdate} = cdate(1970,1,1) then
true
)

this would then ignore the dates if the parameter wa not changed.

The subreport syntax will include some specific formatting demonstrating that it references the main report parameter, please observe it's formatting.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top